File tree Expand file tree Collapse file tree
spring-security-cache-control/src/main/java/com/baeldung/cachecontrol Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- package com .baeldung .cachecontrol . app ;
1+ package com .baeldung .cachecontrol ;
22
33
44import org .springframework .boot .SpringApplication ;
Original file line number Diff line number Diff line change 55import com .baeldung .cachecontrol .model .UserDto ;
66import org .springframework .http .CacheControl ;
77import org .springframework .http .ResponseEntity ;
8+ import org .springframework .stereotype .Controller ;
89import org .springframework .web .bind .annotation .PathVariable ;
910import org .springframework .web .bind .annotation .RequestMapping ;
1011import org .springframework .web .bind .annotation .RequestMethod ;
11- import org .springframework .web .bind .annotation .RestController ;
1212
1313import java .time .LocalDateTime ;
1414import java .time .ZoneOffset ;
1515import java .util .concurrent .TimeUnit ;
1616
17- @ RestController
17+ @ Controller
1818public class ResourceEndpoint {
1919
2020 @ RequestMapping (value = "/users/{name}" , method = RequestMethod .GET )
Original file line number Diff line number Diff line change 22
33
44import org .springframework .context .annotation .Configuration ;
5+ import org .springframework .security .config .annotation .method .configuration .EnableGlobalMethodSecurity ;
56import org .springframework .security .config .annotation .web .builders .HttpSecurity ;
67import org .springframework .security .config .annotation .web .configuration .EnableWebSecurity ;
78import org .springframework .security .config .annotation .web .configuration .WebSecurityConfigurerAdapter ;
89
910@ Configuration
1011@ EnableWebSecurity
12+ @ EnableGlobalMethodSecurity (prePostEnabled = true )
1113public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {
1214
1315 @ Override
You can’t perform that action at this time.
0 commit comments