Spring Boot

Multiple Database Support

Multiple database support means one Spring Boot application can run on different relational databases (H2, MySQL, PostgreSQL) without changing its Java code. Spring Boot picks the database from configuration: the driver on the classpath, the spring.datasource.* settings, and the active profile. Each database has its own settings file (application-h2.yml, application-mysql.yml, application-postgres.yml), and you switch between […]

Multiple Database Support Read More »

Row Mapping

A database query returns rows of columns, but your Java code works with objects like Student. Row mapping is the step that converts each row into an object. In JdbcTemplate, a RowMapper does this: Spring runs the query, calls your mapper once per row, and collects the objects into a List. It is used so

Row Mapping Read More »

JdbcTemplate

JdbcTemplate is Spring’s helper class for running SQL through JDBC. It opens and closes connections, prepares statements, loops through result sets, and handles exceptions for you. Traditional JDBC needs about 15 lines (connection, statement, result set, try/catch/finally) for one query. With JdbcTemplate it is one line: jdbcTemplate.query(sql, rowMapper, args). It also turns checked SQLExceptions into

JdbcTemplate Read More »

Working with Postgres Database Access with Spring Boot

Working With Postgres Database Access refers to integrating and managing access to a PostgreSQL relational database within a Spring Boot application. PostgreSQL is known for its strong SQL standards compliance, robust extensibility, and advanced features (such as JSON/JSONB support and full-text search). Spring Boot provides seamless support for PostgreSQL through managed connection pooling, simplified query

Working with Postgres Database Access with Spring Boot Read More »

Response Handling

Response handling is how your API answers a client: the JSON body, the HTTP status code (200, 201, 404 and so on), and the headers. Spring Boot converts a returned Java object into JSON automatically, and ResponseEntity lets you control the status code and headers as well. It is used so clients can tell success

Response Handling Read More »

Request Body

The request body is the data a client sends inside a POST or PUT request, usually as JSON. @RequestBody tells Spring to read that JSON and convert it into a Java object automatically, using the Jackson library (this is called deserialization). It is used for sending structured data such as registration forms, orders, or profile

Request Body Read More »

Query Parameters

Query parameters are key=value pairs added to the end of a URL after ? and joined with &, like /students/search?name=ravi&department=CSE. In a controller, @RequestParam reads each one and passes it into the method, converting it to the parameter’s type. They are used for optional search, filtering, sorting, and paging, where the URL still points to

Query Parameters Read More »

Path Variables

A path variable is a value written inside the URL itself, such as the 5 in /students/5. In the mapping you write a placeholder like /students/{id}, and @PathVariable captures the real value and passes it into the controller method. It is used to identify a specific resource (one student, one order, one course) in clean,

Path Variables Read More »

Request Mapping

Request mapping tells Spring which controller method should handle which request, based on the URL and the HTTP method. @RequestMapping on a class sets the base URL, and @GetMapping, @PostMapping, @PutMapping, @DeleteMapping on methods narrow it down. It is used so one URL like /api/students can do different things (read, create, update, delete) depending on

Request Mapping Read More »

Controllers

A controller is the class that receives HTTP requests from clients, decides what to do with them, and returns a response. Spring maps each URL and HTTP method (GET, POST, PUT, DELETE) to a controller method using annotations like @GetMapping and @PostMapping. It is used to keep the web layer separate: the controller only handles

Controllers Read More »

Scroll to Top