Springboot开发常用注解说明(Continuous Up
2018-06-08 本文已影响0人
李2牛
-
@Mapper
:是mybatis的注解,注明是一个 mapper接口 -
@Controller
和RestController
-
@RestController
:等于@ResponseBody
+@Controller
,只返回return中的内容,无法解析成带有相关的后缀的视图页面。如果需要返回的是Json,Xml,mediaType需要使用这个注解。 -
@Controller
:需要结合视图解析器InternalResourceViewResolver使用,返回视图的前缀名称。
-
@Repository
: spring注解,说明是一个dao访问的类或者接口 -
@Component
:使用注解需要将类申明被扫描为一个bean,可以使用@Component 注解
5.@Service
: 标注为service -
@PropertySource
: 引入一个属性文件