/******************************************************************************* * Copyright (c) 2015 Development Gateway, Inc and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the MIT License (MIT) * which accompanies this distribution, and is available at * https://opensource.org/licenses/MIT * * Contributors: * Development Gateway - initial API and implementation *******************************************************************************/ package org.devgateway.toolkit.web.rest.controller; import java.util.List; import org.devgateway.toolkit.persistence.mongo.dao.Customer; import org.devgateway.toolkit.persistence.mongo.repository.CustomerRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; /** * * @author mpostelnicu * */ @RestController public class SaveCustomerController { @Autowired private CustomerRepository customerRepository; @RequestMapping("/createCustomer") public List<Customer> createCustomer() { customerRepository.save(new Customer("Alice", "Smith")); customerRepository.save(new Customer("Bob", "Smith")); List<Customer> findAll = customerRepository.findAll(); return findAll; } }