Browsed by
Author: Mirthbees

Blogger, Innovator, Developer and Enterpreneur. Founder of GuruRecharge, Readymade online recharge script. Lead Developer in Bookrate.in
Spring Boot Docker Deployment Steps

Spring Boot Docker Deployment Steps

Spring Boot Docker Deployment Steps Pre requisite: Install Java. [code] sudo yum install java-1.8.0 sudo yum remove java-1.7.0-openjdk [/code] Install Maven [code] sdk install maven [/code] Note: SDKMan can be used to install the maven. Spring Boot Jar – Docker Deployment Steps: Step 1: Create some folder in your linux machine.[create build folder inside /var] Step 2: Docker deployment file creation Create the below content as Dockerfile: [Filename: Dockerfile without any extension and must be available in “/var/build” path] [code]…

Read More Read More

846 total views, no views today

How to add canonical link to all routers in Angular 7?

How to add canonical link to all routers in Angular 7?

How to add canonical link to all routers in Angular 7? When I was trying to find a snippet on how to add canonical link to all routers in Angular 7, I was able to find out lot of snippets in stackoverflow, github and few other blogs. But When I tested all the snippets from both stackoverflow and github, below snippet is the one which is working properly without any issues in all the use cases. Few issues I observed…

Read More Read More

801 total views, no views today

Letsencrypt commands for beginners

Letsencrypt commands for beginners

Letsencrypt commands for beginners ./certbot-auto certificates: This commands lists down all the letsencrypt certificates (both active and expired) with exact path details where the certificate exists. ./certbot-auto certonly -a standalone: This command helps to create a new ssl certificate, if you want to create for more than one domain then enter the domain names with comma. ./letsencrypt-auto renew: This command renews all your existing letsencrypt certificates. This blog explain in detail about the letsencrypt certificate renewal process and stuffs. ./certbot-auto…

Read More Read More

626 total views, no views today

Mockito for beginners

Mockito for beginners

Mockito for beginners: Mockito is an open source testing framework, and it is a widely used for junit testing with mocking beans/repositories in frameworks such as spring mvc & spring boot. The framework allows the creation of test double objects in automated unit tests for the purpose of test-driven development or behavior-driven development. The framework’s name and logo are a play on mojitos, a type of drink. How to Mock void method ? doNothing().when(couponRepository).deleteAll(Mockito.any()); Note: deleteAll is a void method….

Read More Read More

660 total views, no views today

Creating a SOAP web service with Spring Boot

Creating a SOAP web service with Spring Boot

Creating a SOAP web service with Spring Boot Main Application Spring Boot File: package com.ngdeveloper; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class CouponApplication { public static void main(String[] args) { SpringApplication.run(CouponApplication.class, args); } } pom.xml file: This below pom.xml file contains the plugin to generate the output directory files from the xsd file, so create the pom.xml, xsd file, endpoints then by starting your spring boot application you will be able to find the other required files generated. These are…

Read More Read More

857 total views, 4 views today

2 ways to refer classpath resource in spring boot projects

2 ways to refer classpath resource in spring boot projects

2 ways to refer classpath resource in spring boot projects   Using ClasspathResource import org.springframework.core.io.ClassPathResource; @Bean public XsdSchema mySchema() { return new SimpleXsdSchema(new ClassPathResource("myfile.xsd")); }   Note: Here myfile.xsd should be located in src/main/resources. Using Resource import org.springframework.core.io.Resource; @Value("classpath:myfile.xsd") private Resource res; @Bean public XsdSchema mySchema() { return new SimpleXsdSchema(res); } 745 total views, no views today

745 total views, no views today

How to create a Simple RabbitMQ listener in Spring boot ?

How to create a Simple RabbitMQ listener in Spring boot ?

How to create a Simple RabbitMQ listener in Spring boot ?   We are going to create a simple rabbitmq listener in the same spring boot project, but general usecase would be to use rabbitmq is between different microservices / different spring boot projects. This is to make a understanding of how to use rabbitmq and what are all things we need to do for a rabbitmq connectivity.   Prerequisite: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-amqp</artifactId> </dependency> Step 1: Declare a queue name…

Read More Read More

726 total views, no views today

Hibernate – Tutorials & Examples

Hibernate – Tutorials & Examples

Hibernate All Annotations – Tutorials & Examples @Embeddable: This annotation can be used for the joining tables, by default it is not even necessary with hibernate, but if your intermediate joining table needs any other addtional columns to be added, then you must have @Embeddable annotated class. Do remember, in spring boot projects, we used to create repository for all the entity files, so even though we have embedded class separately, we should not create repository classes for this.  …

Read More Read More

711 total views, no views today

How to copy files from linux ec2 to your desktop?

How to copy files from linux ec2 to your desktop?

How to copy files from linux ec2 to your desktop? Please install Mobaxterm software, which is available here, this software is available for both community and premium versions. You will be able to download the files from aws ec2 linux machine to your local desktop system using free community version itself. Command Syntax: scp -i DOCKER-PEM-FILE-PATH AWS-EC2-ID:/ec2-path/* /home/mobaxterm/Desktop/   This command copies all the ec2-path folder data to your local system’s desktop location. Example: scp -i aws-pair.pem ec2-user@ec2-1-2-3-4.us-2.compute.amazonaws.com://YOUR_FOLDER/YOUR_FILE /home/mobaxterm/Desktop/  …

Read More Read More

667 total views, no views today

Creating keystore.p12 from letsencrypt certificate for spring boot projects:

Creating keystore.p12 from letsencrypt certificate for spring boot projects:

Creating keystore.p12 from letsencrypt certificate for spring boot projects: Step 1: Stop your server If your server is nginx then use the below command to stop the server. sudo service nginx stop   Step 2: Generating new letsencrypt certificate This is to create the new letsencrypt certificate, if you already have one certificate then skip this step. ./certbot-auto certonly -a standalone \ -d ngdeveloper.com -d www.ngdeveloper.com -d admin.ngdeveloper.com here -d takes all this domains for this certificates, meaning the same…

Read More Read More

1,240 total views, 3 views today