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