Spring boot quick glance and deployment on azure

Source: Internet
Author: User

Spring Boot inherits the power of the spring framework while eliminating the complexity of the spring framework, and its built-in Tomcat container makes web development extremely efficient and convenient.

In addition, as the cost of technologies such as cloud computing and clustering has been declining and becoming popular, the concept of microservices (Micro-service) has evolved, and we can look at MicroServices as a small program, a basic computing unit that implements a function that is often "self-contained "The HTTP server (self-hosting). These features allow small programs to exist independently and are extremely easy to deploy. Can be easily deployed to individual compute nodes. Speaking of which, many people find that Nodejs is very well equipped to develop microservices, however, with spring Boot, the Java language can be used as a convenient way to develop microservices, and the Java language is inherently strong-type features to ensure the robustness of the program.

here is a simple spring boot-based program, the program is very simple, only two files, the main program Application.java and controller Democontroller.java.


Application.java

Application.java@springbootapplicationpublic class Application {public static void main (string[] args) {Spring    Application.Run (Application.class, args); }}


Democontroller.java

@RequestMapping ("/hello") public String Hello () {return ' Hello World ';}


Compile the package to generate an executable jar package Application.jar, and then enter Java-jar application.jar on the command line to start the program. Open the browser, enter Http://localhost:8080/hello to see the output of the program



It can be seen how easy it is to develop a Web application using spring boot, and we don't need to configure an HTTP server to build a Java application container. A jar package can "break the world".


If we develop a microservices and package them into jars, we can put it on the cloud or on a local server with a network. How to run on the local server will not be mentioned, in short, directly run Java-jar Xxx.jar can be implemented micro-service deployment. Let's take a look at how to deploy this jar package to Microsoft's Azure cloud service.

First we need to log in to Azure to create a Web App. Click "Create A Resource", "Web + Mobile", "Web App"



Then fill in the program name, select the subscription account


After creation, go to the Web App Configuration screen, allow Git to upload, and set up an upload account.


Enter application settings to open Java support


Now that we've created and configured the Web app, we're ready to deploy our jar package to the cloud.

First we clone the items on the cloud to local, go to overview, and then copy the Git clone URL. Use Git clone http://xxx on the command line to clone to local. The initial project has only one HTML file and an empty WebApps directory.


Copy our jar package into WebApps, then create a new Web. config file in the project root directory


Copy the following content to the Web. config file

<?xml version= "1.0" encoding= "UTF-8"?><configuration> <system.webServer> 


then use the git command to add, submit to the cloud, so that the deployment is complete! Next, we open the browser, enter the project URL https://XXXX.azurewebsites.net can access to see Hello World.



Spring boot quick glance and deployment on azure

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.