ch.wisv.areafiftylan.web.controller.WebPropertiesController.java Source code

Java tutorial

Introduction

Here is the source code for ch.wisv.areafiftylan.web.controller.WebPropertiesController.java

Source

/*
 * Copyright (c) 2016  W.I.S.V. 'Christiaan Huygens'
 *
 *     This program is free software: you can redistribute it and/or modify
 *     it under the terms of the GNU General Public License as published by
 *     the Free Software Foundation, either version 3 of the License, or
 *     (at your option) any later version.
 *
 *     This program is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     GNU General Public License for more details.
 *
 *     You should have received a copy of the GNU General Public License
 *     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package ch.wisv.areafiftylan.web.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import static ch.wisv.areafiftylan.utils.ResponseEntityBuilder.createResponseEntity;

@RestController
@RequestMapping("/web/properties")
public class WebPropertiesController {

    @Value("${a5l.googleMapsAPIkey:API_KEY}")
    private String googleMapsKey;

    @RequestMapping(value = "/googlemapskey", method = RequestMethod.GET)
    public ResponseEntity<?> getGoogleMapsKey() {
        return createResponseEntity(HttpStatus.OK, this.googleMapsKey);
    }
}