001/*
002 * Copyright 2002-2016 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      https://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.web.bind.annotation;
018
019import java.lang.annotation.Documented;
020import java.lang.annotation.ElementType;
021import java.lang.annotation.Retention;
022import java.lang.annotation.RetentionPolicy;
023import java.lang.annotation.Target;
024
025import org.springframework.core.annotation.AliasFor;
026
027/**
028 * Annotation for mapping HTTP {@code GET} requests onto specific handler
029 * methods.
030 *
031 * <p>Specifically, {@code @GetMapping} is a <em>composed annotation</em> that
032 * acts as a shortcut for {@code @RequestMapping(method = RequestMethod.GET)}.
033 *
034 *
035 * @author Sam Brannen
036 * @since 4.3
037 * @see PostMapping
038 * @see PutMapping
039 * @see DeleteMapping
040 * @see PatchMapping
041 * @see RequestMapping
042 */
043@Target(ElementType.METHOD)
044@Retention(RetentionPolicy.RUNTIME)
045@Documented
046@RequestMapping(method = RequestMethod.GET)
047public @interface GetMapping {
048
049        /**
050         * Alias for {@link RequestMapping#name}.
051         */
052        @AliasFor(annotation = RequestMapping.class)
053        String name() default "";
054
055        /**
056         * Alias for {@link RequestMapping#value}.
057         */
058        @AliasFor(annotation = RequestMapping.class)
059        String[] value() default {};
060
061        /**
062         * Alias for {@link RequestMapping#path}.
063         */
064        @AliasFor(annotation = RequestMapping.class)
065        String[] path() default {};
066
067        /**
068         * Alias for {@link RequestMapping#params}.
069         */
070        @AliasFor(annotation = RequestMapping.class)
071        String[] params() default {};
072
073        /**
074         * Alias for {@link RequestMapping#headers}.
075         */
076        @AliasFor(annotation = RequestMapping.class)
077        String[] headers() default {};
078
079        /**
080         * Alias for {@link RequestMapping#consumes}.
081         * @since 4.3.5
082         */
083        @AliasFor(annotation = RequestMapping.class)
084        String[] consumes() default {};
085
086        /**
087         * Alias for {@link RequestMapping#produces}.
088         */
089        @AliasFor(annotation = RequestMapping.class)
090        String[] produces() default {};
091
092}