Skip to main content

Posts

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   <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <scope>runtime</scope> <optional>true</optional> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <scope>runtime</scope> </dependency> <dependency> <groupId>org.projectlombok</gro

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 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-mongodb</artifactId> </dependency> <dependency> <groupId>de.flapdoodle.embed</groupId> <artifactId>de.flapdoodle.embed.mongo</artifactId> </dependency> 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 = &

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         timestamp , profile default.png     9    ); Table created.   ---------create sequence---------------for useridseq SQL> CREATE SEQUENCE usersidseq    start with 1     increment by 1     minvalue 0    maxvalue 10000     cycle; Sequence cr

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.technoidentity.ag

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.technoidentity.ag