Spring Framework 4.3 New Feature RequestMapping: @GetMapping, @PostMapping, @PutMapping, @DeleteMapping

Spring Framework 4.3 has some Web improvements. In the article, JavaSampleApproach will introduce you about New Feature RequestMapping: @GetMapping, @PostMapping, @PutMapping, @DeleteMapping, and @PatchMapping.

Related Post: Spring MVC – @RequestMapping with Methods, Headers, Params, @PathVariable and @RequestParam


I. Technologies

– Java 1.8
– Maven 3.3.9
– Spring Tool Suite – Version 3.8.1.RELEASE
– Spring Boot: 1.4.3.RELEASE

II. Overview
1. Project Structure

spring new feature request mapping project structure

2. Step to do

– Create SpringBoot project
– Create a simple model
– Create New Feature RequestMapping
– Run and check result

III. Practices
1. Create SpringBoot project

Open SpringToolSuite, on main menu, choose File->New->Spring Boot Starter, input project information. Press Next, then Finish, a SpringBoot project is created succesfully.
Open pom.xml file, add Web dependency:

2. Create a simple model

3. Create New Feature RequestMapping

Create @GetMapping, @PostMapping, @PutMapping, @DeleteMapping

4. Run and check result

Build & Run SpringBoot project then check result:

– Get RequestMapping:
new feature requestmapping spring mvc @getmapping

– POST RequestMapping:
new feature requestmapping springmvc @postmapping

– PUT RequestMapping:
new feature requestmapping springmvc @putmapping

– DELETE RequestMapping:
new feature requestmapping springmvc @deletemapping

ResfulWebServices Logs:

IV. Sourcecode

SpringMVCNewFeatureRequestMapping


Related Posts



2 thoughts on “Spring Framework 4.3 New Feature RequestMapping: @GetMapping, @PostMapping, @PutMapping, @DeleteMapping”

  1. is package scanning configuration required to tell Spring which Java source packages to initialize the beans from?

    1. Hi,

      With SpringBoot application, we have:
      @SpringBootApplication = @Configuration + @EnableAutoConfiguration + @ComponentScan.

      @EnableAutoConfiguration annotation implicitly defines a base search package is the root package: com.javasampleapproach.newfeaturerequestmapping.

      Regards,

Got Something To Say:

Your email address will not be published. Required fields are marked *

*