Birthdate Speciality | Azure SpringBoot
Tags: azuretrialhack, azure
Published: 2022-03-08 19:50:44




Hey,have you ever counted how many days are left for your birthday?Whats your birthstone? What's your Zodiac and Shēngxiào? No!
Don't worry this web app will find it for you.

### Submission Category: Java Jackpot

### Overview of My Submission

Hello everyone, here is my Fun type Java Spring boot web app which will help you count days left for your next Birthday.
And Moreover,it will tell you your Birthstone,zodiac,etc.


Lets start building the project and deploy it on Azure Web Service for Java
 

#### Setup and requirements for this project :
- Java Framework : Spring Boot
- Project Management Tool : Maven
- IDE : IntelliJ
- IntelliJ plugin : Azure Toolkit for Intellij
- Deployment : Azure
- Browser : Chrome

and yes some coffee...


#### Step 1: Download SpringBoot Template from Spring Initializr

Spring Initialzr helps us to create Spring boot Web app in easy way. It also has amazing option to add dependencies to our springboot app.

Link : https://start.spring.io/
(official website from SpringBoot)

Here is the Screenshot of this project bootstrapping with the help of Spring Initializr

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jqqmlissqj4kq0qqfhdu.png)

1. Give your project name and Description(you can also change the group but I have left it default)
2. Dependencies : Spring Web, Spring Boot Devtools, Thymeleaf(Template engine).
3. Select the options
  - Project : Maven
  - Language : Java
  - SpringBoot version : Leave it Default selected
  - Packaging : jar
  - Java : 11

Then click on 'GENERATE'. Zip file will be downloaded.

Yay!!!Our initial setup is ready🎉.

#### Step 2: Java Spring Boot Web App Code
{% github https://github.com/StarTrooper08/BirthdateSpeciality %}


#### Step 3: Deployment Process using IntelliJ on Azure Spring Boot

1. After, we are done with building web app and tested by running on localhost. Lets deploy it to azure spring cloud using IntelliJ Azure plugin.
2. Go to the settings option of IntelliJ(you can see it on top upper right side in the IDE)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rw9r2vz22aznxi8nzvgi.png)
3. Click on plugin option
4. Search for Azure Toolkit plugin.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p5neoh4bboy2f2zj3stp.png)
5. Install the plugin and restart the IntelliJ IDE. It will get installed.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jxy0eevg9gbwl2wza4sc.png)
6. Now click on the main project and head towards Azure option. After hovering on Azure you will see many option we will be using Spring Cloud option. But before that we need to connect intelliJ IDE with Azure.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kq4ykxm70ugjqldnk053.png)
7. Now click on Azure Spring Cloud.Here you will be asked to sign in with your Azure Account.Many options are available to sign in,you can go with any option.I have signup with OAuth option here.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eudmdsivhqgkibav8hq1.png)
8. After done with sign-in. One pop up will be showed on IDE regarding Azure subscription. And IntelliJ and Azure connection will done successfully.
9. And then go to the azure portal and select Azure Spring Cloud option for creating spring boot service instance for our web app.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dxn4fojqh0uln7nc04gz.png)
10. Click on create button
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1ftoo6cghaqqde2o1ktc.png)
11. Now we will be asked for giving our service instance name and asked to select region.After that click on review and create. Now have patience, let the Azure do the magic.It will take few minutes to deploy our service instance. After our service instance get deployed successfully. Head towards IntelliJ IDE(I suggest restarting IDE before moving to next step).
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k5yvs7vnvro2sk4tjoks.png)
12. Now we have service instance. Lets deploy our java spring boot web app on it. Open the option as shown in Step 3.6. And click on Azure Spring Cloud. You will get some pop up below.
Select the Service instance created and add the app name by clicking on the + sign.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dni4bn2y0aaeljfvb7mz.png)
13. Now for app we need to select some options. Example below.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nlxwld5w69mlke5m007a.png)
14. Now click on apply and run. The app deployment will start(please dont click on any buttons like run stop app in IDE or else the deployment process will stop and fails) 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dni4bn2y0aaeljfvb7mz.png)
15. After few minutes our app will deployed successfully and we will following output in our IDE console.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ckhpopin0lky0rl4mj1i.png)
16. We can have a look in Azure portal to cross check whether our SpringBoot app is successfully deployed or not.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d7ukhhki8abocuhyzxll.png)
17. We can get the link to our springboot app in Application dashboard (And even in IDE console)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vqrc1kblwilh881fkpy1.png)


#### Final Output :

1. Home Page:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wvtbro7y39u8m02cx3hf.png)

2. Result Page:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uvakgfuve9f4uulqjlkq.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z97lr1a2nwakrw8a6vz5.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pyzbhy04ukkbz9ckp1sz.png)

3. Web App link : https://birthdate-speciality-service-birthdate-sp-app.azuremicroservices.io

> ##### Yes we have successfully Created our Spring Boot Web Application and deployed it on Azure using Spring Cloud Service🎉🚀.


##### Resources credit:
1. Azure Docs : 
 - https://docs.microsoft.com/en-us/azure/spring-cloud/quickstart?tabs=IntelliJ&pivots=programming-language-java#provision-an-instance-of-azure-spring-cloud
 - https://docs.microsoft.com/en-us/learn/paths/az-900-describe-cloud-concepts/
2. Spring Boot : https://spring.io/projects/spring-boot
3. Apache Commons: https://commons.apache.org/