Recipe Name:
Use composed requestmapping annotations
Description:
Improve readability by using Spring's composed annotations
Level:
info
Language:
- java
Tags:
- Spring
- framework specific
- web
- Spring Web
- quality
Documentation
Spring provides composed @RequestMapping
annotations which contribute to more readable and less verbose code.
@RequestMapping(method = RequestMapping.POST)After
@PostMappingReferences
Recipe
id: scw:spring:web:requestmapping-composed version: 10 metadata: name: Use composed requestmapping annotations shortDescription: Improve readability by using Spring's composed annotations level: info language: java enabled: true descriptionFile: descriptions/Usecomposedrequestmappingannotations.html tags: Spring;framework specific;web;Spring Web;quality search: annotation: owner: method: {} parameters: - name: method value: referenceTo: name: caseSensitive: false matches: org.springframework.web.bind.annotation.RequestMethod.(GET|POST|PATCH|PUT|DELETE) availableFixes: - name: Use a composed annotation actions: - changeAnnotation: type: org.springframework.web.bind.annotation.{{#upperCaseFirst}}{{#lowerCase}}{{{ markedElement.elementValuePairs.method.value.name }}}{{/lowerCase}}{{/upperCaseFirst}}Mapping removeParameter: - withName: method