Angular integrated Spring boot,spring SECURITY,JWT and Cors

Source: Internet
Author: User
Tags spring initializr

This article describes the basic configuration of spring boot and angular the method of integrating spring boot and spring security. The current popular JWT is more suitable for integration with angular than the csrf provided by spring secuity. In addition, Springfox-swagger and Spring-boot-starter-actuator are introduced, demonstrating how to use swagger to generate JSON API documentation and how to use actuator to monitor applications.

The front end of this article is based on angular official sample tour of Heroes, please go to the official website to download.

Technology stack

Spring Boot 1.5.10.RELEASE
Spring Security
Spring Data
JWT
Swagger
Angular 5.0

Angular 5.0 new Features
? Improved compilation performance, AOT compilation speed, has become the recommended compilation method in development
? I18N support for new number, date, currency pipes
? With Staticinjector instead of Reflectiveinjector, reflect Polyfill is no longer needed, reducing app size.
? Exportas supports multiple names
? The original @angular/http module has expired, the recommended use of httpclient
? New Router Lifecycle Events
Guardscheckstart, Childactivationstart, Activationstart, Guardscheckend, Resolvestart, ResolveEnd, ActivationEnd, Childactivationend
? More rigorous grammar checking

Spring boot create Spring boot App

The easiest way to create a spring boot project is to use the spring INITIALIZR

After you enter group, Artifact, select dependency, click Generate Project to generate a zip package. After downloading, unzip, edit Pom file, add JAVA-JWT and Springfox-swagger. The completed Pom file is as follows:

<?xml version= "1.0" encoding= "UTF-8"? ><project xmlns= "http://maven.apache.org/POM/4.0.0" xmlns:xsi= "http ://www.w3.org/2001/XMLSchema-instance "xsi:schemalocation=" http://maven.apache.org/POM/4.0.0 Http://maven.apache . org/xsd/maven-4.0.0.xsd "> <modelVersion>4.0.0</modelVersion> <groupid>org.itrunner</ groupid> <artifactId>heroes</artifactId> <version>1.0.0-SNAPSHOT</version> <packagi Ng>jar</packaging> <name>heroes</name> <description>demo Project for Spring Boot</desc ription> <parent> <groupId>org.springframework.boot</groupId> <artifactid>spri Ng-boot-starter-parent</artifactid> <version>1.5.10.RELEASE</version> <relativepath/&gt    ; </parent> <properties> <project.build.sourceencoding>utf-8</project.build.sourceencoding&gt        ; <project.reporting.outputEncoding>utf-8</project.reporting.outputencoding> <java.version>1.8</java.version> </pro perties> <dependencies> <dependency> <groupid>org.springframework.boot</group Id> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> < Dependency> <groupId>org.springframework.boot</groupId> <artifactid>spring-boot -starter-web</artifactid> </dependency> <dependency> &LT;GROUPID&GT;ORG.SPRINGF Ramework.boot</groupid> <artifactId>spring-boot-starter-security</artifactId> &LT;/DEP endency> <dependency> <groupId>org.springframework.boot</groupId> <ar            Tifactid>spring-boot-starter-actuator</artifactid> </dependency> <dependency> <groupid>com.autH0</groupid> <artifactId>java-jwt</artifactId> <version>3.3.0</version&gt        ; </dependency> <dependency> <groupId>io.springfox</groupId> <artifa        Ctid>springfox-swagger2</artifactid> <version>2.8.0</version> </dependency> <dependency> <groupId>io.springfox</groupId> <artifactid>springfox-swa gger-ui</artifactid> <version>2.8.0</version> </dependency> <dependenc            Y> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> <scope>runtime</scope> </dependency> <dependency> <groupid>org.s Pringframework.boot</groupid> <artifactId>spring-boot-starter-test</artifactId> &L T;scope>test</scope> </dependency> <dependency> <groupid>org.springframework.security </groupId> <artifactId>spring-security-test</artifactId> <scope>test</sco pe> </dependency> </dependencies> <build> <plugins> &LT;PLUGIN&G                T <groupId>org.springframework.boot</groupId> <artifactid>spring-boot-maven-plugin</arti factid> </plugin> </plugins> </build></project>

Not finished, to be continued

Angular
Spring Boot
Spring Security
JWT Libraries
Springfox Swagger
Postman
Angular security-authentication with JSON Web Tokens (JWT): The Complete Guide
Integrating Angular 2 with Spring Boot, JWT, and CORS, part 1
Integrating Angular 2 with Spring Boot, JWT, and CORS, part 2

Angular integrated Spring boot,spring SECURITY,JWT and Cors

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.