spring-boot 實現通過訪問路徑後加參數返回json數據

http://localhost:8080/order/getCustomerAccount?format=json  只要在url後面加上format的參數既可,controller方法返回一個object就可以了。不用加什麼@ResponseBody註解。繼承WebMvcConfigurerAdapter類重寫configureContentNegotiation方法即可
相關文章
相關標籤/搜索