@RestController 和 @RequestMapping 注解是Spring MVC注解
@EnableAutoConfiguration
@SpringBootApplication 注解等價于以默認屬性使用 @Configuration , @EnableAutoConfiguration 和 @ComponentScan 。
@Profile
Spring Profiles提供了一種隔離應(yīng)用程序配置的方式,并讓這些配置只能在特定的環(huán)境下生效。任何@Component或@Configuration都能被@Profile標記,從而限制加載它的時機。
@Profile("production")
@ResponseBody
@Component:
@AutoWired
@RequestParam:
@PathVariable: 路徑變量。
@value注解來讀取application.properties里面的配置
全局處理異常的: @ControllerAdvice: 包含@Component??梢员粧呙璧健?br> 統(tǒng)一處理異常。
@ExceptionHandler(Exception.class): 用在方法上面表示遇到這個異常就執(zhí)行以下方法。
在SpringBootApplication上使用@ServletComponentScan注解后,Servlet、Filter、Listener可以直接通過@WebServlet、@WebFilter、@WebListener注解自動注冊,無需其他代碼。
@ConfigurationProperties(prefix = "httpApi.crm")
@ConfigurationProperties
@JsonInclude @JsonInclude(value=Include.NON_NULL)這個注解的意思是說,在序列化的過程中,如果對象的某個屬性的值為空null,則這個屬性就不會出現(xiàn)在json中;可能是前端這么要求,也可能是減少數(shù)據(jù)傳輸流量的要求;
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")private Date birthday;