SSM常用注解总结
目录
一、Spring
@Component / @Controller / @Service / @Repository
@Configuration
@ComponentScan
@Scope
@PostConstruct
@PreDestroy
@Autowired
@Qualifier
@Value
@PropertySource
@Bean编辑
@Import
@RunWith
@ContextConfiguration编辑
@EnableAspectJAutoProxy
@Aspect编辑
@Pointcut编辑
@Before编辑
@After编辑
@AfterReturning编辑
@AfterThrowing编辑
@Around编辑
@EnableTransactionManagement
@Transactional编辑
二、SpringMVC
@Controller编辑
@RequestMapping
@ResponseBody编辑
@ComponentScan编辑
@RequestParam编辑
@EnableWebMvc编辑
@RequestBody
@DateTimeFormat编辑
@ResponseBody编辑
@PathVariable编辑
@RestController编辑
@GetMapping @PostMapping @PutMapping @DeleteMapping编辑
@RestControllerAdvice编辑
@ExceptionHandler编辑
三、MyBatisPlus
Lombok常见注解:
@TableField编辑
@TableName编辑
@TableId编辑
@TableLogic编辑
*SSM框架是spring、spring MVC 、和mybatis框架的整合,是标准的MVC模式。
*标准的SSM框架有四层,分别是dao层(mapper),service层,controller层和View层。
*使用spring实现业务对象管理,使用spring MVC负责请求的转发和视图管理,mybatis作为数据对象的持久化引擎。
MybatisPlus:
(简称MP)是基于MyBatis框架基础上开发的增强型工具,旨在简化开发、提供效率。
一、Spring
@Component / @Controller / @Service / @Repository
@Configuration
@ComponentScan
@Scope
@PostConstruct
@PreDestroy
@Autowired
@Qualifier
@Value
@PropertySource
@Bean
@Import
@RunWith
@ContextConfiguration
@EnableAspectJAutoProxy
@Aspect
@Pointcut
@Before
@After
@AfterReturning
@AfterThrowing
@Around
@EnableTransactionManagement
@Transactional
二、SpringMVC
@Controller
@RequestMapping
@ResponseBody
@ComponentScan
@RequestParam
@EnableWebMvc
@RequestBody
@DateTimeFormat
@ResponseBody
@PathVariable
@RestController
@GetMapping @PostMapping @PutMapping @DeleteMapping
@RestControllerAdvice
@ExceptionHandler
三、MyBatisPlus
Lombok常见注解:
@Setter:为模型类的属性提供setter方法
@Getter:为模型类的属性提供getter方法
@ToString:为模型类的属性提供toString方法
@EqualsAndHashCode:为模型类的属性提供equals和hashcode方法
@Data:是个组合注解,包含上面的注解的功能
@NoArgsConstructor:提供一个无参构造函数
@AllArgsConstructor:提供一个包含所有参数的构造函数
@TableField
@TableName
@TableId
@TableLogic