Top Tweets for #getmapping
Which annotation maps HTTP GET requests to a controller method?
A. @RequestMapping(method = GET)
B. @GetMapping
C. @HttpGet
D. @Get
@RequestMapping @getmapping @postmapping @PutMapping @DeleteMapping @intellijidea @java Better View 🔍

REQUEST MAPPING 💛
@RequestMapping("/api/users") ← applies to ALL methods below
@GetMapping("/{id}") → GET /api/users/{id} @PostMapping → POST /api/users @PutMapping("/{id}") → PUT /api/users/{id}
@DeleteMapping("/{id}") // → DELETE /api/users/{id}
#CtrlPlusCode #Java

Pagination: The Backend Feature That Saves Performance
If your API returns 50,000 records in one response…
😓 Server struggles
💾 Memory spikes
🐢 Response slows down
📉 System fails under load
That’s where Pagination becomes critical.
🧠 What is Pagination?
Pagination means fetching data in small chunks (pages)
instead of loading everything at once.
Instead of:
GET /users → returns 50,000 rows
We do:
GET /users?page=0&size=10
Now we fetch only what’s needed.
Small response.
Faster API.
Better scalability.
⚡ Without Pagination
• Returns ALL records at once
• High memory usage
• Slow response time
• Poor scalability
• Risk under heavy traffic
Result:
Uncontrolled data flow.
✅ With Pagination
• Returns small chunks of data
• Controlled memory usage
• Faster response
• Scalable under load
• Production-ready API
Result:
Controlled data access.
📌 Why It Matters in Real Systems
Every large product —> Amazon, Netflix, LinkedIn never loads everything at once.
They paginate.
Because performance is not optional.
It’s architecture.
🛠 How to Implement in Spring Boot
Repository:
public interface UserRepository extends JpaRepository<User, Long> {}
Service:
Pageable pageable = PageRequest.of(page, size);
Page<User> users = userRepository.findAll(pageable);
Controller:
@GetMapping("/users")
public Page<User> getUsers(
@RequestParam int page,
@RequestParam int size) {
Pageable pageable = PageRequest.of(page, size);
return userRepository.findAll(pageable);
}
🎯 Interview Questions I Was Asked
Q1. What is the difference between Page and Slice?
A. Page executes a count query. Slice does not.
Q2. Why can deep pagination hurt performance?
A. Large offsets force the database to scan many rows before returning data.
Q3. How do you optimize pagination in high-scale systems?
A. Use indexing, limit page size, and prefer keyset pagination when needed.
🧠 Final Understanding
Pagination is not just about splitting data.
It is about controlling how much data leaves your database.
Returning everything is easy.
Returning only what’s needed is engineering.
If this made Pagination finally click for you
👍 Like
💾 Save (interview gold)

Spring Boot Concept That Interviews LOVE to Test .
@RequestMapping vs @GetMapping
How Spring Boot maps CRUD operations
This is one of those Spring Boot topics that looks simple, but silently decides how clean (or messy) your APIs become.
Let’s break it down below:
@RequestMapping
This is the generic, parent mapping annotation.
• Can handle all HTTP methods
• Requires explicit configuration
• Flexible, but verbose
Example:
@RequestMapping(value = "/users", method = RequestMethod.GET)
Good for:
• Base paths like /api/v1
• Special or mixed mappings
@GetMapping
This is a specialized, modern shortcut.
• Handles only GET requests
• Clean and readable
• Self-documenting code
Example:
@GetMapping("/users")
Preferred for:
• Read / fetch operations
How this maps to CRUD operations.
CRUD in REST APIs directly maps to HTTP methods:
CREATE → @PostMapping (POST /users)
READ → @GetMapping (GET /users)
UPDATE → @PutMapping (PUT /users/{id})
DELETE → @DeleteMapping (DELETE /users/{id})
This is why Spring provides
@GetMapping, @PostMapping, @PutMapping, and @DeleteMapping.
The golden rule:
@RequestMapping → base or generic paths
@Get / @Post / @Put / @Delete → CRUD actions
Cleaner code.
Clear intent.
Fewer bugs.
One-liner to remember forever:
> CRUD operations = HTTP methods
> Spring mappings make that relationship explicit.

@victortenold @RestController @getmapping @postmapping Thank you so much! I really appreciate the encouragement.
@anshi326094 @RestController @getmapping @postmapping That’s a solid foundation. Once the Controller → Service → Repository flow clicks, everything else in Spring starts making way more sense. Keep going
Day 3 of learning Java+Springboot
Today I understood how :
. @Restcontroller handles requests
.@GetMapping and @PostMapping work
. Data flows from Controller - - - >Service--->Repository.
Small concepts step by step.
#LearnInPublic #Java #BuildInPublic #100DaysOfCode
Spring Boot 4.0 API Versioning: Evolve Your REST APIs Without Breaking Clients:
Spring Boot 4.0 adds first-class API versioning directly in @RequestMapping
/ @GetMapping
annotations.
No more manual path prefixes (/v1/, /v2/) or custom filters declare versions declaratively.
Supports URL path, header (X-API-Version), or query param strategies out-of-the-box.
Perfect for microservices where APIs evolve over years without client rewrites.
Works seamlessly with Spring Boot 4's modular design, virtual threads, and GraalVM.

POSTING TILL I GET A JOB
DAY 51
today i tried to connect backend with frontend to see how it works just a hello world program spring boot for BE and vanilla JS for FE
LEARNINGS => CORS Origin, RestController, GetMapping.

POSTING TILL I GET A JOB
DAY 51
today i tried to connect backend with frontend to see how it works just a hello world program spring boot for BE and vanilla JS for FE
LEARNINGS => CORS Origin, RestController, GetMapping.

Now the main component comes in action "DispatcherServlet"
>DispatcherServlet = Request traffic controller.
>The DispatcherServlet hands the request to Handler Mapping.
>Handler Mapping looks through all the controllers and checks their annotations — @GetMapping, @PostMapping, @RequestMapping, etc.
>It finds the exact method whose URL pattern and HTTP method match the incoming request.
3/n

@DamiLupo con GET me refiero al verbo HTTP , @GetMapping. Más bien me refiero a la URI que debes usar para obtener un "recurso" cuando usas RESTful API naming conventions:
GET /api/product/find/1
Siguiendo las convenciones de REST, debería ser algo como:
GET /api/products/1
@mario_casari @RestController @getmapping Only left to know how to authenticate users by retrieving their data from database.
At the moment, credentials are hardcoded to easily debug, but obviously is a temporary solution.
🚀 Spring Boot tip: With Spring Boot and Spring Security you can secure endpoints easily.
✅ To secure the following REST endpoint:
@RestController
public class MyController {
@GetMapping("/admin")
public String admin() {
...
}
...
}
✅ You can write a configuration like this:
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/admin").authenticated()
.anyRequest().permitAll()
.and()
.httpBasic();
}
}
✅ authorizeRequests(): Starts the definition of endpoints that need protection.
✅ antMatchers("/admin").authenticated(): Requires authentication for /admin.
✅ anyRequest().permitAll(): All other endpoints are public.
✅ httpBasic(): Enables HTTP Basic Auth
#SpringBoot #SpringSecurity #Java
💡 Spring Boot tip: To write cleaner REST controllers use @RestController instead of @Controller + @ResponseBody.
🛠️@RestController is a meta-annotation that includes @ResponseBody, which is then automatically applied to all methods:
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Controller
@ResponseBody
public @interface RestController {
}
❌ With @Controller and @ResponseBody:
@Controller
public class MyController {
@ResponseBody
@GetMapping("/hello")
public String hello() {
return "Hello!";
}
}
✅ With @RestController:
@RestController
public class MyController {
@GetMapping("/hello")
public String hello() {
return "Hello!";
}
}
#SpringBoot #CleanCode
What is the difference between @ GetMapping and @ RequestMapping?

𝐒𝐭𝐞𝐩 𝟏: 𝐒𝐞𝐭 𝐔𝐩 𝐭𝐡𝐞 𝐁𝐚𝐜𝐤𝐞𝐧𝐝 (𝐒𝐩𝐫𝐢𝐧𝐠 𝐁𝐨𝐨𝐭)
Initialize a Spring Boot project using Spring Initializr or your IDE.
Add dependencies:
🔹Spring Web (for REST APIs)
🔹Spring Data JPA (for database access)
🔹MySQL Driver (or your preferred DB)
𝗖𝗿𝗲𝗮𝘁𝗲 𝗥𝗘𝗦𝗧𝗳𝘂𝗹 𝗲𝗻𝗱𝗽𝗼𝗶𝗻𝘁𝘀 using annotations like @ RestController, @ GetMapping, @ PostMapping, etc.
Run your Spring Boot app to expose the API (typically on port 8080.

GET Endpoint for Product List:
@GetMapping maps HTTP GET requests to this method, making it accessible via /products.
The method returns a static list of product names, simulating a simple product catalog.

@ayshriv @RestController @RequestMapping @getmapping JAX-RS is a much better and more powerful set of annotations. MicroProfile Rest Client works great with JAX-RS interfaces!
Build your first REST API with Spring Boot:
- Create a Spring Boot project
- Use @RestController
- Map endpoints with @GetMapping, @PostMapping, etc.
- Return POJOs — Spring handles the JSON
#SpringFramework #Java #ayshriv

Mastering Spring Boot?
Don’t ignore Spring REST.
Build powerful, scalable APIs with just a few annotations.
Start with @RestController, @RequestMapping, and @GetMapping.
#SpringBoot #Java #ayshriv

@MarvinTlaloc @getmapping @PathVariable int id
Additionally, we can add regular expression too
@GetMapping("/users/{id:\\d+}")
public ResponseEntity<User> getUserById(@PathVariable int id) {
@Manishrysk @getmapping It's been a few days now, what annotation were you thinking about @Manishrysk ?
You have a Spring Boot application with two REST endpoints:
`@GetMapping("/users")`
`@GetMapping("/users/{id}")`
What annotation would you add to the second endpoint to ensure that the `{id}` path variable is only matched if it's a numeric value?
Drop your answers below👇
Spring MVC Annotations
1️⃣@ GetMapping - Retrieve data
2️⃣@ PostMapping - Send new data
3️⃣@ PutMapping - Update existing data
4️⃣@ DeleteMapping - Remove data
5️⃣@ PathVariable - Extract from URL path
#Java
Trends for you
Most Popular Users

Elon Musk 
@elonmusk
239.8M followers

Barack Obama 
@barackobama
118.6M followers

Cristiano Ronaldo 
@cristiano
114.3M followers

Donald J. Trump 
@realdonaldtrump
111.7M followers

Narendra Modi 
@narendramodi
106.9M followers

Rihanna 
@rihanna
98.6M followers

NASA 
@nasa
92.1M followers

Justin Bieber 
@justinbieber
91.7M followers

KATY PERRY 
@katyperry
89.9M followers

Taylor Swift 
@taylorswift13
83.9M followers

Lady Gaga 
@ladygaga
75.4M followers

Virat Kohli 
@imvkohli
73.3M followers

Kim Kardashian 
@kimkardashian
70.8M followers

YouTube 
@youtube
68.6M followers

Neymar Jr 
@neymarjr
66.3M followers

Bill Gates 
@billgates
65.1M followers

Selena Gomez 
@selenagomez
63M followers

The Ellen Show
@theellenshow
62.1M followers

CNN 
@cnn
61.7M followers

X 
@x
60.6M followers





















