Further Reading on Spring Boot 1. Spring Boot Hibernate 5 Example 2. Spring Boot H2 Database Example 3. Spring Data Jpa Example 4. Spring Boot Jms Activemq Example 5. Spring Mvc Contentnegotiating Viewresolver Example
springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @RestController @RequestMapping("/product") public class ProductController { @Autowired private ProductService productService; @GetMapping("/{id}") public CommonResponse getProduct(@PathVariable("id") ...
(@PathVariable("id") String id) { return "test role: " + id; } /** * 需要登录验证, 用户的 AuthorityList("admin, ROLE_USER") * 有注解 @PreAuthorize("hasRole('USER')"), 有 USER role, 直接放行 */ @PreAuthorize("hasRole('USER')") @GetMapping("/test/role2/{id}") public ...
importorg.springframework.boot.actuate.endpoint.web.annotation.RestControllerEndpoint; importorg.springframework.http.MediaType; importorg.springframework.web.bind.annotation.GetMapping; importorg.springframework.web.bind.annotation.PathV...
springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @RestController @RequestMapping("/product") public class ProductController { @Autowired private ProductService productService; @GetMapping("/{id}") public CommonResponse getProduct(@PathVariable("id") ...