springmvc 注解带示例

Springmvc 注解

@Controller()
@Autowired //spring 提供注解,通过类型装配
 
@ModelAtrrbuter("/url") //用在controller方法执行之前执行。
@requestMapping(value="",
method="",
params{"name=aa","pas"} , 必须携带的参数,且name="aa",pas 值不指定这两个参数时方法才执行
@RequestParam("petId") ,//相当request.getParameter("petId")
consumes=" 请求的提交内容类型",
produces="返回的内容类型" )
@ResponseBody 将返回对象写入到Response对象的body中
@pathVariable 将url 模板中的变量参数映射到方法参数上
 

@Service() imp 实现类上使用
@Respority()//daoimpl 注解
@Component //通用注解 尽量不使用
 
 
原文地址:https://www.cnblogs.com/2016-cxp/p/8654737.html