package com.fqc.springboot.controller;

import com.fqc.springboot.model.Customer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by fqc on 2016/7/9.
 */
@RestController
@RequestMapping("/customer")
@EnableAutoConfiguration
public class CustomerController {
    public static final ArrayList<Customer> customerList = new ArrayList<>();

    static {
        customerList.add(new Customer(1L, "kobe kobe"));
        customerList.add(new Customer(2L, "james james"));
        customerList.add(new Customer(3L, "jordan jordan"));
    }

    @RequestMapping(value = "list",method = RequestMethod.GET)
    public List<Customer> list() {
        return customerList;
    }

    public static void main(String[] args) {
        SpringApplication.run(CustomerController.class, args);
    }
}

@@ -193,24 +193,85 @@
 figuration;%0A
+import org.springframework.web.bind.annotation.PathVariable;%0A
 import org.s
@@ -950,15 +950,22 @@
 e = 
-%22
+%7B%22/
 list%22,
+%22%22%7D, 
 meth
@@ -1055,24 +1055,538 @@
 ist;%0A    %7D%0A%0A
+    @RequestMapping(value = %22/%7Bid%7D%22, method = RequestMethod.GET)%0A    public Customer getCustomerById(@PathVariable Integer id) %7B%0A        Customer customer = null;%0A        for (Customer c : customerList) %7B%0A            if (c.getId() == Long.parseLong(id.toString())) %7B%0A                customer = c;%0A            %7D%0A        %7D%0A        if (customer == null) %7B%0A            //%E4%BB%A5%E5%90%8E%E5%8F%AF%E4%BB%A5%E5%AF%B9%E8%B1%A1%E7%BB%9F%E4%B8%80%E6%B6%88%E6%81%AF%EF%BC%8C%E5%B0%81%E8%A3%85%E4%BF%A1%E6%81%AF%0A            //return %22not found%22; %E6%88%96%E8%80%85 throw new Exception%0A            return null;//%E6%9A%82%E6%97%B6%E5%A4%84%E7%90%86%0A        %7D%0A%0A        return customer;%0A    %7D%0A%0A
     public s

修改list路由为{/list，''}，增加根据id查询bean实体 返回json