Loading... ### spring ```java // 控制器 @SpringBootApplication @RestController @RequestMapping @PostMapping @GetMapping @PutMapping @DeleteMapping @RequestBody @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") // IOC @Component @Mapper @Service // DI @Resource @Autowired ``` ### 全局异常处理器 ```java @RestControllerAdvice // 全局异常处理器 @ExceptionHandler // 全局异常处理方法 ``` ### 事务 ```java @EnableScheduling // 开启注解方式的事务管理 @Transactional // 开启事务 ``` ### 过滤器 ```java @ServletComponentScan // 自动扫描和注册 Servlet、Filter 和 Listener 组件 @WebFilter("/*") ``` ### 配置 ```java @Configuration @Bean ``` ### 切面 ```java @Aspect // 注册切面类 @Pointcut("execution(* com.sky.mapper.*.*(..)))") // 定义切入点 @Before("autoParamCut()") @Around("autoParamCut()") @After("autoParamCut()") ``` ### 自定义注解 ```java @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) ``` ### spring cache ```java @EnableCaching @CachePut(cacheNames = "item", key = "#id") @Cacheable(cacheNames = "item", key = "#id") @CacheEvict(cacheNames = "item", allEntries = true) ``` ### spring task ```java @EnableScheduling @Scheduled(cron = "0/5 * * * * *") ``` ### webSocket ```java @ServerEndpoint("/ws/") ``` 最后修改:2024 年 09 月 11 日 © 允许规范转载 赞 1 如果觉得我的文章对你有用,请随意赞赏