1、@Autowired:依赖主入(DI),不用new,按类型装配
2、@Resource:按名称装配,若没有指定name,那么就按照类型来注入。
config:
3、@Configuration:配置类
4、@ConfigurationProperties:通过prefix属性指定配置前缀,通过location指定配置文件路径
dao:
5、@Reponsitory(实现类):
entity:
6、@Entity
7、@Table:对应数据库表
service实现类:
@service
@Transaction
controller层:
8、@RestController:返回数据是json格式, RestController=ResponseBody+Controller;单使用@Controller,可返回jsp。
9、@RequestMapping:设置访问的URL,以及返回值的类型。produces属性可以设置返回数据的类型以及编码,可以是json或者xml。
10、@PostMapping:(方法上);@PostMapping是一个作为快捷方式的组合注释,@RequestMapping(method = RequestMethod.POST)
value: 指定请求的实际地址
method: 指定请求的method类型, GET、POST、PUT、DELETE等
consumes: 指定处理请求的提交内容类型,例如application/json, text/html;
produces: 指定返回的内容类型,仅当request请求头中的(Accept)类型中包含该指定类型才返回
params: 指定request中必须包含某些参数值是,才让该方法处理
headers: 指定request中必须包含某些指定的header值,才能让该方法处理请求
@RequestBody:参数放在request体中,通过方法解析出来。
声明Bean的注解:
@Component、@Service、@Repository、@Controller、