Spring注解的含义

就我目前用到的来说说spring注解的含义:

      @Controller

  负责注册一个bean 到spring 上下文中(实际上就是一个加工厂)

  @RequestMapping

  注解为控制器指定可以处理哪些 URL 请求

  @ResponseBody

  该注解用于将Controller的方法返回的对象,写入到Response对象的body数据区(不跳转直接返回对象)

  @RequestParam 

  在处理方法入参处使用 @RequestParam 可以把请求参 数传递给请求方法

     @Service

• 例如
 public class SoftCreateServiceImpl implements ISoftCreateService {}

扫描二维码关注公众号,回复: 2996987 查看本文章

@Service 负责注册一个bean 到spring 上下文中,bean 的ID 默认为类名称开头字母小写(复杂逻辑处理)
@Autowired

通过 @Autowired的使用来消除 set ,get方法。

这是目前我使用到的

猜你喜欢

转载自blog.csdn.net/qq_33188563/article/details/81988306