Image taken from https://itnext.io/upgrading-bash-on-macos-7138bd1066ba

1. Source command

Source command executes the contents of the file which is passed as the argument to it

Let’s say we have two Java versions — Java 8 & Java 11

We often switch between the versions by changing the JAVA_HOME in ~/.bash_profile


Image taken from https://foxutech.com/how-to-build-a-docker-image-using-dockerfile/

Let’s assume we are containerising an Angular application & we created Dockerfile at project’s root directory

FROM nginx:1.17.1-alpineCOPY nginx.conf /etc/nginx/nginx.confCOPY /dist/my-app /usr/share/nginx/html

Lets build our Angular project first

> ng build --prod

After build, project directory looks like below


Image from Google Search

Java 11 came up with a cool feature to execute source code in single file without compiling it pre-hand

Lets assume Vicky.java file contains following beautiful world changing source code

class Vicky {

public static void main(String[] args) {
System.out.println("Hello World!");
}
}

For ages, we do the following

> javac Vicky.java (creates Vicky.class file)> java Vicky"Hello World !"

But from Java 11, its further simplified like below

> java Vicky.java"Hello World !"

So how it works ?

  • From Java 11, java command can compile as well as execute the Java source file
  • Remember, no .class file…


Image credits — extremetech.com

Because of the monopoly Intel enjoys in processor market, they are way costlier than their competitors.

But recently AMD giving good fight with Intel with some very good processors in terms of performance & cost

Take two laptops of similar configuration but one with Intel & other with AMD processor

Here is an live example (From Flipkart)


Image from https://codingrabbithole.com/set-up-mysql-in-docker-with-docker-compose/

MySQL Docker container supports executing init scripts on startup

All we need to do is either copy or mount our script files to /docker-entrypoint-initdb.d/ folder inside MySQL docker image

docker-compose.yaml

Things to note

We have renamed the schema.sql & data.sql files as 1.sql & 2.sql respectively on mounting (refer line no 11 & 12). This was done for a reason.

MySQL docker container executes script files from /docker-entrypoint-initdb.d/ folder in the ascending order of file names

E.g. In case we have data.sql & schema.sql, data.sql will be executed first before schema.sql file

If you want more control over the script file’s execution order, please rename the files with numbers in ascending order (refer line no 11 & 12)


Usually we open IntelliJ & import the project from File menu. But how to do the same from your terminal ?

Here is how

Open IntelliJ -> Tools -> Create Command Line Launcher & choose the script name & location & hit OK

Choose the name & where the script has to get created. In above image, idea is the script name

To check if the changes are working

> cd <SOURCE_CODE_FOLDER>// If the project is Maven> idea pom.xml// If the project is Gradle> idea build.gradle

Now the project should get open in IntelliJ

Thats all folks !


Lets consider we have a RestController class which has two endpoints to expose User & List<User>

User & UserController class

Since id & dob fields in User object are sensitive, we don’t want to expose them in our endpoints.

Jackson library provides @JsonIgnore & @JsonIgnoreProperties annotations to ignore fields while serializing

Here is a sample code

One catch with @JsonIgnore & @JsonIgnoreProperties annotations are — They expect field names in compile time itself. But what if our consumer want to ignore few fields dynamically based on their input ?

We can use MappingJacksonValue class to achieve the above requirement


Github + Azure DevOps Pipeline + Tomcat + Azure App Service

Step by step instruction on how to deploy Spring Boot application WAR file into Tomcat running in Azure App Service (using Azure DevOps Pipeline)

Remember, we are not gonna use Docker for this

Creating an Azure App Service

  • Login to https://portal.azure.com/ & click on App Service -> Create App Service
  • Create new resource group (E.g. sample-resource-group) by click on Create new hyperlink


Containerize your SpringBoot application in no time…

In my previous post, we discussed how to deploy a SpringBoot WAR file into Tomcat running in Docker

Here in this post, we are going to see how to run SpringBoot Web application JAR file directly in Docker

SpringBoot came up with a clever idea to achieve it. When you add Spring-Boot-Starter-Web dependency, it adds Embedded Tomcat JAR file to our class path

Embedded Tomcat Jar (Embedded Jetty/UnderTow also available) can do all things standalone Tomcat can do expect that Embedded Tomcat Jar is packed along with our application JAR file

Lets take my sample Spring Boot Application (Refer here…


Azure DevOps CD to deploy Docker image of Spring Boot Application into Azure App Service

Deploy from DockerImage Azure Container Registry to Azure App Service

This is second among series of articles on how to build & deploy a SpringBoot Application into Azure App service using Azure DevOps CI & CD

I highly recommend to read Azure DevOps CI/CD — Creating CI for code hosted in Github article before reading this

Steps

  1. Lets create a new CD pipeline
  2. Time to create container registry
  3. Lets create a resource group
  4. Enter container registry details in CI pipeline

Lets create a new CD pipeline

  • Click on Pipelines -> Release -> New Pipeline

Vicky AV

Twitter @IamVickyAV

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store