@@ -0,0 +1,1934 @@
+/*%0A * Copyright 2015 Benedikt Ritter%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage com.heroku.demo;%0A%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.stereotype.Controller;%0Aimport org.springframework.ui.ModelMap;%0Aimport org.springframework.validation.BindingResult;%0Aimport org.springframework.web.bind.annotation.ModelAttribute;%0Aimport org.springframework.web.bind.annotation.RequestMapping;%0Aimport org.springframework.web.bind.annotation.RequestMethod;%0A%0Aimport javax.validation.Valid;%0Aimport java.util.List;%0A%0A@Controller%0A@RequestMapping(%22/bis%22)%0Apublic class HomeControllerBis %7B%0A%0A    private RecordRepository repository;%0A%0A    @Autowired%0A    public HomeControllerBis(RecordRepository repository) %7B%0A        this.repository = repository;%0A    %7D%0A%0A    @RequestMapping(method = RequestMethod.GET)%0A    public String home(ModelMap model) %7B%0A        List%3CRecord%3E records = repository.findAll();%0A        model.addAttribute(%22records%22, records);%0A        model.addAttribute(%22insertRecord%22, new Record());%0A        return %22home%22;%0A    %7D%0A%0A    @RequestMapping(method = RequestMethod.POST)%0A    public String insertData(ModelMap model, %0A                             @ModelAttribute(%22insertRecord%22) @Valid Record record,%0A                             BindingResult result) %7B%0A        if (!result.hasErrors()) %7B%0A            repository.save(record);%0A        %7D%0A        return home(model);%0A    %7D%0A%7D%0A

test rest 2