Skip to main content

Posts

How to Use swagger in your project | How to configure swagger in your project

 This is the Dependency you have to add =================================================== 1.Springfox Swagger UI  <!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui --> <dependency>     <groupId>io.springfox</groupId>     <artifactId>springfox-swagger-ui</artifactId>     <version>2.6.1</version> </dependency> 2. springfox swagger2 <!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger2 --> <dependency>     <groupId>io.springfox</groupId>     <artifactId>springfox-swagger2</artifactId>     <version>2.6.1</version> </dependency> -------------------------------------------------------------------- 2. Write Controller class like that   package com.app.rest; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.a

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+", "); }   } }

Reverse The Array

πŸ˜€This is the Program of Reverse the Array  it is very sufficient and easy way I am doing this code  package ds.Arrays; import java.util.Arrays; public class Reverse_The_Arrays_2 { public static void main(String[] args) { int arr[]=new int[] {10,20,30,40,50,60}; int i=0,j=arr.length-1; while(i<j) { int temp=arr[i]; arr[i]=arr[j]; arr[j]=temp; i++; j--;    } System.out.println(Arrays.toString(arr)); } }

Find Maximum and Minimum Element in Arrays

 πŸ˜‰  This is the program of Find Maximum and Minimum Element in Arrays very good and easy way I am doing this code. package ds.Arrays; public class Find_The_Max_Min_Element_In_Array { public static void main(String[] args) { int arr[]=new int[] {10,20,30,40,60,3}; int max=-65535,min=65536; for (int i = 0; i < arr.length; i++) { if(arr[i]>max) max=arr[i]; if(arr[i]<min) min=arr[i]; } System.out.println("Max :"+max+"\t Min:"+min); } }

Why IT is Better in 2021?

 πŸ˜€ Why IT is Better in 2021? Here... Why IT is Better in 2021 idea tips to help you           make the new concepts, you are learning as a beginner to  become a Master in          any IT area to develop your self.  InCOVID-19, record-high unemployment numbers and the collapse of entire     industry sectors, 2020 has been a miserable year for older workers. In fact, for the    first time in nearly 50 years, older workers face higher unemployment     than mid-career workers, 1.so I think in this digital world we have to need digital/ technical knowledge.     We can make our bright career with digital marketing. Join     Digital marketing classes & get the best job in 2021 months.   But 2021 is three years from now, and I think u have plenty of time to find in which field u have interest and passion. Because there is no use to follow    cat race because sooner or later you gonna get    frustrate about what u will be doing.   So follow your dreams and passion success will be behind yo