spring-boot of notes (continually updated)

Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/qq_36209121/article/details/76228497

spring-boot of notes (continually updated)

Look at the recent spring-boot, in this summary of some commonly used direct use:


@RequestHeader

  • Obtaining request header parameter values;
@RequestMapping("/test/02")
	public Object test02(@RequestHeader(value = "accept") String acceptHeader) {
		//不区分大小写
		return "Request 'accept' header value : " + acceptHeader;
	}

@PathVariable

  • Obtaining dynamic parameters of the interface;
@ResponseBody
@RequestMapping("/html/demo/{message}")
public String demMessage(@PathVaribale String message) {
	return "hello " + message;
}

@Bean

  • Xml placed above corresponds to the process, rather than a class, generating means of a bean, and to manage spring;

@ConfigurationProperties

  • Configuration information file properties, is injected into the java class @Bean used in combination;

@Primary

  • When a plurality of data sources used to distinguish the primary data source;

@Qualifier

  • When a plurality of the same type Bean using @Qualifier ( "name") to specify, commonly used with @Autowired descriptor may be defined by name in addition to implanting, may also be distinguished by a finer density.;

@MapperScan

  • We mapper arrangement position to be scanned, may be added to the starting class spring-boot, the annotations may be added in the Mapper classes @Mapper above;

Use of the mapper class mabatis

@Seletc

  • Is a query class notes, all queries are using this;

@Result

  • Modified result set returned, the entity class attributes associated database fields and one correspondence, if the entity class and attribute database;
  • @Seletc

  • Is a query class notes, all queries are using this;

@Insert

  • Into the database, it can also be directly into the entity class will automatically parse the attribute to a corresponding value;

@Update

  • Responsible for changes, you can also pass an object;

@Delete

  • Responsible for deleting;

Guess you like

Origin blog.csdn.net/qq_36209121/article/details/76228497