Skip to main content

Posts

How to Send OTP in Mobile Number | login with OTP mobile Number | How to send OTP in mobile no with Spring Boot APP

   😂               Login with Mobile Number OTP ---------------------------------------------------------------------------- If you want to develop a project to log in with OTP mobile Number in Spring Boot Applications then this post for you. In this post, I am going to use some other service to send the OTP in mobile number. we have to use it in this project spring boot. we are going to use Twilio to send SMS. we are going to use a web socket to send the data from the browser to the SMS gateway. Oracle Database for store the user details. org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-thymeleaf 2.3.3.RELEASE com.twilio.sdk twilio 7.1.0 org.springframework.boot spring-boot-starter-websocket org.springframework.boot spring-boot-devtools runtime true package com.app; impo...

Send Email with Spring Boot API | Spring Boot API send email

              😂How to Send Email with Spring Boot API In this post, we are going to implement a project like send an email to the given email Id with Spring Boot we can do this. In this project, users have to send emails and we have to send the email for forgetting the password. Send Email with Spring Boot API 1.pom.xml   Add this despondency . org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-devtools runtime true org.projectlombok lombok true org.springframework.boot spring-boot-starter-test test org.springframework.boot spring-boot-starter-mail 2.application.properties file Add this one server.port=8023 spring.mail.host=smtp.gmail.com spring.mail.port=587 spring.mail.username=technoidentity.vitalz@gmail.com spring.mail.password=technoidentity12345 # Other proper...

Generate Documentation for Spring Boot API with swagger and Open API 3

 😂 How to Generate Documentation for Spring Boot API project Make sure your Project having a swagger or open API 3 Dependency then only you get proper Documentation for your Service. ---------------------------------------------------------------------------- Every method or API above you have to Write Like that then only you get proper Documentation If you do everything in your Application and Run your Application and go to browse and search. . http://localhost:8080/v3/api-docs/ if you want to learn more go with this one.  Open API-3   1. For Return List of Object then you have to use this API operation  @Operation(summary = "This will fetch List of Patient Detailas base on Hospital Name") @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Successfully fetch All Patient Details from Database ", content = {  @Content(mediaType = "application/json" ,array = @ArraySchema(schema =@Schema(implementation =PatientDe...

Array Important Questions | logical Question of Arrays | Important Questions of Arrays in java

😂  Arrays Important Question   😂 All the Questions is very important for Interviews and Written Test. 1) Java Program to copy all elements of one array into another array 2) Java Program to find the frequency of each element in the array 3) Java Program to left rotate the elements of an array 4) Java Program to print the duplicate elements of an array 5) Java Program to print the elements of an array 6) Java Program to print the elements of an array in reverse order 7) Java Program to print the elements of an array present on even position 8) Java Program to print the elements of an array present on odd position 9) Java Program to print the largest element in an array 10) Java Program to print the smallest element in an array 11) Java Program to print the number of elements present in an array 12) Java Program to print the sum of all the items of the array 13) Java Program to right rotate the elements of an array 14) Java Program to sort the elements of an array in ascending...

Spring Boot With MySQL Database connection with Examples | MySQl Database Configuration with Spring Boot Projects

 😃 MySQL Database Configuration with Spring Boot Projects  In this article, we are going to introduce How to connect MySQL Database with the Spring Boot project. pom.xml   org.springframework.boot spring-boot-starter-data-jpa org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-devtools runtime true mysql mysql-connector-java runtime org.projectlombok lombok true    application. properties   server.port=8025 spring.datasource.url=jdbc:mysql://localhost:3306/princedb spring.datasource.username=root spring.datasource.password=root spring.jpa.hibernate.ddl-auto=create-drop MySqlWithSpringBootApplication.java   package com.app; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class MySqlWithSpringBootApp...

How can we create Auto generated field or ID for mongodb using spring boot

😂 How can we create an Auto-generated field or ID for MongoDB using spring boot? First Create One Application Like Mongodb_sequence-id-generator Pom.XML org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-data-mongodb de.flapdoodle.embed de.flapdoodle.embed.mongo User.java package com.app; import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Transient; import org.springframework.data.mongodb.core.mapping.Document; @Document(collection = "users_db") public class User { @Transient public static final String SEQUENCE_NAME = "users_sequence"; @Id private long id; private String firstName; private String lastName; private String email; public User() { } public User(String firstName, String lastName, String email) { this.firstName = firstName; this.lastName = la...

Send Email with Java Projects

    😂      How to send Mail With Java Code You Use this Code to Send the Email in your project  In this article, We are going to learn about How to send Emails with Java programs or codes. it I very interesting thin if you are a java developer. We are going to cover how to send emails to another email with video also. package com.app; import java.util.Properties; import javax.mail.Authenticator; import javax.mail.Message; import javax.mail.PasswordAuthentication; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; public class App { public static void main(String[] args) { System.out.println("Hello World! prince "); String subject = "Sending Mail for Testing"; String message = "I want to learn Java with Prince kumar ojha"; String form = "pk22cs@gmail.com"; String to = "pk22cs1998@gmail.com"; sendMailing(subject, message, form, to);...

Base64 Encode and Decode password with Base64 Use with example

  😁 Base 64 Example: In this example, we are going to learn about How to encrypt a password and decodes the password in the java program language. With this article, we will understand What is encoding and decoding in java with the Base64 class. import java.util.Scanner; import java.util.Base64; class Test { public static void main(String[] args) { Scanner sc=new Scanner(System.in); System.out.println("Enter Password"); String password=sc.next(); System.out.println("Encode password: "+encode(password)); String encode=encode(password); System.out.println("Decode Password: "+decode(encode)); } //Encode: public static String encode(String input) { return Base64.getEncoder().encodeToString(input.getBytes()); } //Decode: public static String decode(String input) { byte[] decodedBytes = Base64.getDecoder().decode(input); return new String(decodedBytes); } }

How to create table in project realtime exprience

😂If you want to create a table in Oracle and MySql then this is for you . to create a database of our project.  If you want to know how to create a table for real projects like for the User table or the Register table then this article for you? Register table for sign up ============================== SQL> conn Enter user-name: techblog Enter password: Connected. --------------------users table----------------- SQL> create table users (   2      id           number(10) PRIMARY KEY ,   3      name     varchar2(50) NOT NULL,   4      email     varchar2(50) unique,   5      gender   varchar2(10) NOT NULL,   6      about      varchar2(200) DEFAULT 'hey ! I am using TechBlog',   7      password  varchar2(50) NOT NULL,   8      rdate      ...

Spring Boot Curd Operation Without try, catch and If else inside the method 100% correct test

 package com.technoidentity.agastya.controller; import java.util.Date; import java.util.ArrayList; import java.util.List; import java.util.Optional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.technoidentity.agastya.model.TelemetryEvent; import com.technoidentit...

SpringBoot Curd Operation Controller Class

 package com.technoidentity.agastya.controller; import java.util.Date; import java.util.ArrayList; import java.util.List; import java.util.Optional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.technoidentity.agastya.model.TelemetryEvent; import com.technoidentit...

How to Use Open API 3 tools in our Spring Boot Project | Its alternate of Swagger tools

 Setting up spring doc-open API To have springdoc-openapi automatically generate the OpenAPI 3 specification docs for our API, we simply add the springdoc-openapi-ui dependency to our pom.xml: <dependency>     <groupId>org.springdoc</groupId>     <artifactId>springdoc-openapi-ui</artifactId>     <version>1.5.2</version> </dependency> Then when we run our application, the OpenAPI descriptions will be available at the path /v3/api-docs by default: http://localhost:8080/v3/api-docs/ To use a custom path, we can indicate in the application.properties file: springdoc.api-docs.path=/api-docs Now we'll be able to access the docs at: http://localhost:8080/api-docs/ The OpenAPI definitions are in JSON format by default. For yaml format, we can obtain the definitions at: http://localhost:8080/api-docs.yaml ---------------------------------------------------------------------- If you want to test like post man then ...

How to test Microservices' Controller with mokito and Junit

Add Dependency In your project ---------------------------------------------------- compileOnly 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok' testImplementation group: 'junit', name: 'junit' testImplementation group: 'org.mockito', name: 'mockito-all', version: '1.10.19' implementation 'org.springframework.boot:spring-boot-starter-data-mongodb' implementation 'org.springframework.boot:spring-boot-starter-web' developmentOnly 'org.springframework.boot:spring-boot-devtools' testImplementation 'org.springframework.boot:spring-boot-starter-test' =====================================================  package com.technoidentity.agastya; import static org.junit.Assert.assertNotNull; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete; import static org.springframew...

How to push your project to remote repositery | how to send file in server

😂 Below the command, you follow and push your code into repositery. -----------------------------------------------------------------------------------------------  1.git clone -b <branch name> URL of repository 2.cd Inside the current file 3.git branch 4.git status 5.git add --a 6.clear 7.git commit -m "V1.0" 8.git push Dell@DESKTOP-Q0VP55V MINGW64 /p/prince $ git clone -b vitalz-assist-service https://Techno-Identity@dev.azure.com/Techno-Identity/Project%20Agasthya/_git/vitalz-assist-service Cloning into 'vitalz-assist-service'... remote: Azure Repos remote: Found 107 objects to send. (16 ms) Receiving objects: 100% (107/107), 72.30 KiB | 2.68 MiB/s, done. Resolving deltas: 100% (1/1), done. Dell@DESKTOP-Q0VP55V MINGW64 /p/prince $ cd vitalz-assist-service Dell@DESKTOP-Q0VP55V MINGW64 /p/prince/vitalz-assist-service (vitalz-assist-service) $ git status On branch vitalz-assist-service Your branch is up to date with 'origin/vitalz-assist-service'. Untra...