Liquibase with Spring Boot

1. What is Liquibase? Liquibase is a database version control tool. It allows you to manage schema changes (like creating tables, adding columns, indexes, etc.) across environments in a consistent way. With Spring Boot, it integrates seamlessly. 2. Add Dependencies In your pom.xml (Maven project): <dependencies> <!-- Spring Boot Starter Data JPA --> <dependency>…

0 Comments

Spring Boot Data MongoDB

📌 Common Spring Data MongoDB Annotations @DocumentMarks a class as a MongoDB document (like an @Entity in JPA).collection attribute can specify the collection name.@Document(collection = "users") public class User { ... } @IdMarks the primary identifier field (usually _id in MongoDB).@Id private String id; @FieldMaps a Java field to a specific MongoDB field name.@Field("user_name")…

0 Comments

Spring Data Redis

🔹 What is Spring Data Redis? Spring Data Redis provides easy integration with Redis, an in-memory key-value store. It abstracts the low-level Redis API and gives you repositories, templates, pub/sub messaging, and caching support. 🔹 Maven Dependency Add this to your pom.xml: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> </dependency> <dependency> <groupId>io.lettuce</groupId> <artifactId>lettuce-core</artifactId> <!-- Lettuce is the default…

0 Comments

Feign Client in Spring Boot

Feign is a declarative REST client in Spring Cloud that makes writing web service clients easier. Instead of writing boilerplate RestTemplate or WebClient code, you define an interface and annotate it — Spring generates the implementation for you at runtime. Here’s a step-by-step example of using Feign Client in Spring Boot: 1. Add dependencies…

0 Comments

QraphQL in Spring Boot

1. Add Dependencies If you’re using Maven, add the following to your pom.xml: <dependencies> <!-- Spring Boot Starter Web --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <!-- GraphQL Starter --> <dependency> <groupId>com.graphql-java</groupId> <artifactId>graphql-spring-boot-starter</artifactId> <version>5.0.2</version> </dependency> <!-- GraphQL Tools (schema parsing) --> <dependency> <groupId>com.graphql-java-kickstart</groupId> <artifactId>graphql-java-tools</artifactId> <version>11.0.0</version> </dependency> <!-- Optional: GraphiQL UI --> <dependency> <groupId>com.graphql-java-kickstart</groupId> <artifactId>graphiql-spring-boot-starter</artifactId> <version>11.1.0</version> </dependency>…

0 Comments

gRPC in Spring Boot

1. Setup your Spring Boot project You can generate a Spring Boot project via Spring Initializr with the following dependencies: Spring Web (optional for testing REST endpoints) gRPC (we’ll add via Maven) Protobuf (for compiling .proto files) Lombok (optional, for boilerplate reduction) Your pom.xml should include: <dependencies> <!-- Spring Boot Starter --> <dependency> <groupId>org.springframework.boot</groupId>…

0 Comments

RestTemplate in Spring Boot

In Spring Boot, RestTemplate is used to make synchronous HTTP requests to other services (GET, POST, PUT, DELETE). Although Spring recommends using WebClient for reactive applications, RestTemplate is still widely used in many projects. Here's a clear example: 1. Add Dependencies If you are using Maven, make sure you have Spring Web dependency: <dependency>…

0 Comments

Spring Boot WebSocket

WebSocket STOMP refers to using the STOMP protocol (Simple/Streaming Text Oriented Messaging Protocol) over a WebSocket connection. Here’s the breakdown: 1. WebSocket A communication protocol that provides full-duplex, bidirectional communication between client and server over a single TCP connection. Unlike HTTP (request-response), WebSockets let the server push messages to the client in real time.…

0 Comments

Spting Profiles

1. What are Spring Boot Profiles? Spring Boot profiles allow you to group configuration settings for different environments and activate the one you need at runtime. This helps manage multiple environments without changing code. For example: dev → development environment settings test → testing environment settings prod → production environment settings 2. How to…

0 Comments

OpenAPI integration with Spring Boot

1. Add Dependencies In your pom.xml (for Maven), include Spring Boot and Springdoc OpenAPI: <dependencies> <!-- Spring Boot Web --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <!-- Springdoc OpenAPI --> <dependency> <groupId>org.springdoc</groupId> <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId> <version>2.2.0</version> </dependency> <!-- Optional: Lombok for cleaner code --> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <optional>true</optional> </dependency> </dependencies> <dependencies> <!-- Spring Boot Web --> <dependency> <groupId>org.springframework.boot</groupId>…

0 Comments

End of content

No more pages to load