Skip to main content

Posts

How to configure Embedded MongoDB In Spring Boot Project | How to use Embedded MongoDB in our project

 ðŸ˜‚ How to do work with Embedded Spring boot MongoDB.If you do work with we don't require any configurations  Only you have to do is Extends MongoRepositery<> Interface in your project create object use it. 1. Spring Data MongoDB <dependency>   <groupId>org.springframework.boot</groupId>  <artifactId>spring-boot-starter-data-mongodb</artifactId> </dependency> 2. Embedded Spring boot MongoDB <dependency> <groupId>de.flapdoodle.embed</groupId> <artifactId>de.flapdoodle.embed.mongo</artifactId>  //Remove the scope tag in this place     other wise we will get error;  </dependency>

How to configure Spring Boot with Oracle Database

 How to configure Spring boot with oracle --------------------------------------------------------- <dependency>     <groupId>com.oracle.database.jdbc</groupId>     <artifactId>ojdbc8</artifactId>     <scope>runtime</scope> </dependency> ------------------------------------------------- server.port=8023 spring.datasource.url=jdbc:oracle:thin:@localhost:1521:xe spring.datasource.username=prince spring.datasource.password=prince

Google Coding Question

 Google Coding Question  ---------------------------------- 1.TCS/Infosys 2.Amazon / Oracle Input: "96{Amit985Ajit{ ]98"; Output: 96+985+98=1179 ================================================================= class GoogleTest  { public static void main(String[] args)  { String str="96{Amit985Ajit{ ]98";         char arr[]=str.toCharArray();          int sum=0; int total=0; for(int i=0;i<arr.length;i++){                if(arr[i]>='0' && arr[i]<='9'){                sum=sum*10+Character.getNumericValue(arr[i]);    }    else{               total=total+sum;   sum=0;    } } total=total+sum; System.out.println(str); System.out.println(total); } }

Company guides lines for developing the project in real time

 ðŸ‘‰ Real-time project guides lines in my company Code review comments. 1. Branch name should be aligned to the feature you are developing. Name the branch something like - "Agastya-service" 2. This repository will have just one microservice. You don't need a directory named "SpringBootCurdOperationWithMongoDB". 3. Similarly, the repo name should be Agastya-service --> your repository name should not have tech stack mentioned, it has to be Agastya-service. 4. DB Url, you have hardcoded in the application.yml. It should be in your local profile. Have profiles created for the application, define it locally, dev, prod. And along with that, create the application-local.YAML, application-dev.yml, application-prod.yml accordingly. 5. In the application.yml define the profile and enable to pick up the profile during the run time. Your run config should have the variable defined for the profile 6. Modal class, instead of student class - create a class "TelemetryE

MongoDB DataBase Configuration application.properties file

👉 Your MongoDB COnfiguration file  spring. data.MongoDB.authentication-database=admin spring.data.mongodb.username=root spring.data.mongodb.password=root You Can Use this Only Enough. This is for local server MongoDB server.port =8023 spring.data.mongodb.database =srecord spring.data.mongodb.port =27017 spring.data.mongodb.host =localhost This is for Remote Server Mongo DB Atlas cloud server :    port :  8023 spring :    data :      mongodb :        database :  test        uri :  mongodb://prince:root@test-shard-00-00.cswuu.mongodb.net:27017,test-shard-00-01.cswuu.mongodb.net:27017,test-shard-00-02.cswuu.mongodb.net:27017/test?replicaSet=atlas-ofyv9a-shard-0&ssl=true&authSource=admin #mongodb://prince:root@test-shard-00-00.cswuu.mongodb.net:27017,test-shard-00-01.cswuu.mongodb.net:27017,test-shard-00-02.cswuu.mongodb.net:27017/test?replicaSet=atlas-ofyv9a-shard-0&ssl=true&authSource=admin server :    port :  8023 spring :    data :      mongodb :        database :  tes

Program to find the frequency of characters

In this program, we need to find the frequency of each character present in the word. Picture perfect   To accomplish this task, we will maintain an array called freq with same size of the length of the string. Freq will be used to maintain the count of each character present in the string. Now, iterate through the string to compare each character with rest of the string. Increment the count of corresponding element in freq. Finally, iterate through freq to display the frequencies of characters.  import java.util.*; class CharacterFrequenc  { public static void main(String[] args)  { //you have this String you have to find the frequncy of character       String str="bannana you are rock in this world";          //Take one Integer Array to store the frequency of the Data   int count[]=new int[str.length()];      //Convert String to Character Array   char string[]=str.toCharArray();   //Logic of Program         int i=0,j=0;     for(i=0;i<str.length();i++

prime Number in between 1 to 100

 package Logical; // Print prime Number in between 1 to 100  public class PrimeNumberSeries { public static void main(String[] args) { System.out.println("Print Prime Number Between 1 to 100"); int c=0; for(int i=1;i<=100;i++) { c=0; for(int j=2;j<=i/2;j++) {   if(i%j==0) c++; } if(c==0 && i!=1) System.out.print(i+", "); }   } }