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.