//springboot自动装载,不许要制定扫描的包,value值为包的位置
@ComponentScan
//扫描xml文件,在配置类上进行注解
@ImportResource(locations = "classpath:beans.xml")
//导入其他配置类
@Import
//使用Junit进行配置,runwith替换原有的运行器
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(location={"classpath:bean.xml"})
//在其他控制方法前执行
@ModelAttribute
@PathVariable("xxx")
//通过 @PathVariable 可以将URL中占位符参数{xxx}绑定到处理器类的方法形参中@PathVariable("xxx")
@RequestMapping(value="user/{id}/{name}")
//扫描接口为Mapper并进行注入
@Mapper
//获得请求路径中的参数(用于控制方法的参数)
@RequestParam("loginname")
常用注解整理
最新推荐文章于 2024-07-27 17:56:15 发布