SpringMVC simple integration example of Angular2, springmvcangular2

Source: Internet
Author: User

SpringMVC simple integration example of Angular2, springmvcangular2

This article introduces the example of spring MVC simple integration of Angular2 and shares it with you, as follows:

Angular uses the official Quick Start example.


Copy all the files to the springmvc project. If the file path is too long and fails to be copied, compress the entire file and then copy the compressed file, decompress the package. The directory structure is as follows. I copied it to the angular directory.


Spring configuration file setting path


Then introduce the file as shown in angular on the html page.


You need to configure the path of these files.

It mainly needs to be modified in the systemjs. config file.


In this way, the project can run.

However, this can be run because we have compiled Typescript into a js file. It is impossible for us to modify the ts file every time, compile it, and run the project. Therefore, we need to automatically compile Typescript as javascript.

Because the idea editor I use has its own editing and conversion tool, you only need to perform simple configuration (provided that nodejs and Typescript dependencies are installed on the local machine)

File-, Settings-, ages & Frameworks-, node. js and NPM select the node. js installed on the local machine


File-> Settings-> ages & Frameworks-> TypeScript


For typescript version, it is best to select the npm typescript dependency downloaded from the local machine. Select the lib folder.

-P web \ WEB-INF \ angular this command is to indicate the compiled directory, if not, search for the project root path, because we put in the angular directory, so you need to set

This step can be compiled in the editor, but it cannot be automatically compiled.

The steps for hot deployment to tomcat are generally make, then package, and then start the project to achieve automatic compilation. You only need to compile Typescript before make.


The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.

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.