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 POST} requests onto specific handler 029 * methods. 030 * 031 * <p>Specifically, {@code @PostMapping} is a <em>composed annotation</em> that 032 * acts as a shortcut for {@code @RequestMapping(method = RequestMethod.POST)}. 033 * 034 * @author Sam Brannen 035 * @since 4.3 036 * @see GetMapping 037 * @see PutMapping 038 * @see DeleteMapping 039 * @see PatchMapping 040 * @see RequestMapping 041 */ 042@Target(ElementType.METHOD) 043@Retention(RetentionPolicy.RUNTIME) 044@Documented 045@RequestMapping(method = RequestMethod.POST) 046public @interface PostMapping { 047 048 /** 049 * Alias for {@link RequestMapping#name}. 050 */ 051 @AliasFor(annotation = RequestMapping.class) 052 String name() default ""; 053 054 /** 055 * Alias for {@link RequestMapping#value}. 056 */ 057 @AliasFor(annotation = RequestMapping.class) 058 String[] value() default {}; 059 060 /** 061 * Alias for {@link RequestMapping#path}. 062 */ 063 @AliasFor(annotation = RequestMapping.class) 064 String[] path() default {}; 065 066 /** 067 * Alias for {@link RequestMapping#params}. 068 */ 069 @AliasFor(annotation = RequestMapping.class) 070 String[] params() default {}; 071 072 /** 073 * Alias for {@link RequestMapping#headers}. 074 */ 075 @AliasFor(annotation = RequestMapping.class) 076 String[] headers() default {}; 077 078 /** 079 * Alias for {@link RequestMapping#consumes}. 080 */ 081 @AliasFor(annotation = RequestMapping.class) 082 String[] consumes() default {}; 083 084 /** 085 * Alias for {@link RequestMapping#produces}. 086 */ 087 @AliasFor(annotation = RequestMapping.class) 088 String[] produces() default {}; 089 090}