• Stars
    star
    314
  • Rank 132,876 (Top 3 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created about 9 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A RESTful sample using Spring Boot, Spring MVC, Spring Data and Angular/Bootstrap.

angularjs-springmvc-sample-boot

An example application using AnguarJS/Bootstrap as frontend and Spring MVC as REST API producer.

More details about the source codes, please read the online GitBook: Building REST APIs with Spring MVC.

NOTE: This project is under maintenance, no more new features added in future. If you are looking for the new Spring Boot 2 and Angular 5, check angular-spring-reactive-sample.

Technology stack:

  • Spring Boot
  • Spring MVC
  • Spring Data JPA
  • JPA
  • Hibernate 5.2
  • Spring Security
  • Swagger/Swagger2Markup/Spring Rest Docs
  • Spring Test/JUnit/Mockito/JBehave/RestAssured
  • Lombok
  • ModelMapper
  • AngularJS
  • Bootstrap

This version improved the original version(without Spring Boot), including:

  • Introduction of Gulp build system to processing the static resources
  • The frontend UI can be run standalone via NodeJS eco-system
  • An option provided and allow you to package the static resources as part of final jar and run the application via mvn spring-boot:run directly

Requirements

  • JDK 8

    Oracle Java 8 is required, go to Oracle Java website to download it and install into your system.

    Optionally, you can set JAVA_HOME environment variable and add <JDK installation dir>/bin in your PATH environment variable.

  • Apache Maven

    Download the latest Apache Maven from http://maven.apache.org, and uncompress it into your local system.

    Optionally, you can set M2_HOME environment varible, and also do not forget to append <Maven Installation dir>/bin your PATH environment variable.

  • NodeJS

    NodeJS is required to build the frontend static resources.

    Download NodeJS and install it into your local system.

    After it is installed, open terminal, and using node -v command to confirm.

    node -v 
    >v4.2.2
    

    bower is also requried to install the runtime dependencies, and gulp is chosen as our build tools for the statics resources.

    npm install -g bower
    npm install -g gulp
    

Get the source codes

Get a copy of the source codes into your local system.

git clone https://github.com/hantsy/angularjs-springmvc-sample-boot

Run the project

You can use one of the following approaches to run this project.

Run frontend UI and backend respectively

  1. Run the backend API server via Spring Boot.

    mvn spring-boot:run
    

    The backend APIs will run on port 9000.

  2. Run the frontend UI standalone.

    npm install
    bower install
    gulp serve
    

    By default, gulp serves the frontend UI static resources on port 3000.

  3. Go to http://localhost:3000 to test it.

Run the project via Spring Boot maven plugin

  1. Run the following command to resovle the dependencies of the frontend static resources.

    npm install
    bower install
    
  2. Run the backend API server with spring-boot command. The parameter -Dstatic-ui will copy the static resources and package into the jar archive.

    mvn spring-boot:run -Dstatic-ui
    
  3. Go to http://localhost:9000 to test it.

If you want to explore the REST API docs online, there is a Swagger UI configured for visualizing the REST APIs, just go to http://localhost:9000/swagger-ui.html.

Generate static REST API reference documentation

I have moved the REST docs generation configuration into a standalone Maven profile.

Execute the following command to generate HTML and PDF format files for your REST APIs from Swagger API description file and Spring test code snippets(as code samples).

mvn clean package -Drestdocs

The detailed configuration is explained in API documention section.

When it is done, check the generated static docs in target/asciidoc folder, it includes a HTML 5 file(under html folder), and a PDF file(in pdf folder).

Open the pdf document in Adobe Reader, it looks like.

pdf

Docker

You can run the project in multistage Docker building development environment, check Multistage Builds.

More Repositories

1

spring-reactive-sample

Spring 5 Reactive playground
Java
1,228
star
2

spring-webmvc-jwt-sample

Secures REST APIs with Spring Security and JWT Token based Authentication
Java
439
star
3

nestjs-rest-sample

NestJS RESTful APIs Sample
TypeScript
328
star
4

spring-microservice-sample

Spring Boot based Mircoservice sample
Java
298
star
5

angularjs-springmvc-sample

A RESTful sample using AnguarJS/Bootstrap as frontend and Spring MVC as REST API producer
Java
291
star
6

angular-spring-reactive-sample

RESTful API demos with Spring 5 WebFlux, Spring Boot 2, Spring Data Mongo, Spring Security, Spring Session and Angular (upgraded to v13)
TypeScript
224
star
7

spring-reactive-jwt-sample

Secures REST APIs with Spring Security and JWT Token-based Authentication powered by Spring Reactive stack
Java
161
star
8

spring-r2dbc-sample

Code samples for demonstrating R2dbc, Spring R2dbc, and Spring Data R2dbc.
Java
154
star
9

angularjs-cakephp-sample

A RESTful sample using AnguarJS/Bootstrap as frontend and CakePHP as REST API producer.
PHP
113
star
10

spring-puzzles

Code samples for tips, problem-resolving methods, patterns in Spring development
Java
79
star
11

spring-graphql-sample

Spring GraphQL examples using Netflix DGS, GraphQL Java and Spring GraphQL
Java
76
star
12

jakartaee9-starter-boilerplate

Jakarta EE 9 starter boilerplate project
Java
69
star
13

angularjs-grails-sample

A RESTful sample using AngularJS/Bootstrap as frontend and Grails as REST API producer
JavaScript
65
star
14

spring4-sandbox

Sample codes to demonstrate new features of Spring 4.x
Java
59
star
15

jakartaee8-starter-boilerplate

A boilerplate project for starting a Jakarta EE 8 application in seconds
Java
59
star
16

quarkus-sandbox

Quarkus playground
HTML
58
star
17

keycloak-springsecurity5-sample

Spring Security 5 OAuth2 Client/OIDC integration with Keycloak sample
Java
56
star
18

awesome-javaee8

Awesome Java EE 8 resource checklist
52
star
19

spring-kotlin-coroutines-sample

Spring Kotlin Coroutines sample
Kotlin
51
star
20

ee8-sandbox

Java EE 8/Jakarta EE 8 sandbox
Java
49
star
21

ee7-sandbox

Java EE 7 sandbox
Java
40
star
22

spring-sandbox

Spring demo application
Java
39
star
23

rsocket-sample

RSocket sandbox
Java
37
star
24

angularjs-zf2-sample

A RESTful sample using AngularJS/Bootstrap as frontend and Zend2 Framework as REST API producer
PHP
37
star
25

spring6-sandbox

Spring 6 and Spring Boot 3 playground
Java
34
star
26

symfony-rest-sample

Symfony REST Example
PHP
30
star
27

javaee8-jsf-sample

A Java EE 8 sample application
Java
29
star
28

javaee8-jaxrs-sample

RESTful APIs Demo built with Java EE 8 and JAXRS 2.1
Java
29
star
29

jakartaee-faces-sample

Jakarta EE 10 Faces Example
Java
27
star
30

angular-spring-rsocket-sample

Demo for using Angular and Spring RSocket together
TypeScript
26
star
31

vertx-sandbox

Eclipse Vertx playground
Java
24
star
32

spring-reactive-kotlin-sample

Spring 5 Webflux Demo built with Kotlin.
Kotlin
21
star
33

spring-native-example

Spring Native example application
Java
20
star
34

jakartaee9-servlet-starter-boilerplate

A Jakarta EE starter project boilerplate for Jakarta Servlet 5.0 (aligned with Jakarta EE 9) Container
Java
18
star
35

jakartaee-mvc-sample

Jakarta EE 10 MVC sample
Java
17
star
36

angular2-sample

Angular 2 sample with Angular CLI, TypeScript, Angular 2, Bootstrap 4, RxJS, JWT, Firebase/AngularFire2
TypeScript
17
star
37

ee7-jaxrs-sample

Building RESTful APIs with Java EE 7 and JAXRS
Java
17
star
38

javaee8-by-example-gitbook

A developer's notes for Java EE 8 upgrade
16
star
39

spring-webmvc-functional-sample

Spring MVC functional sample
Java
16
star
40

nestjs-graphql-sample

NestJS GraphQL Example
TypeScript
13
star
41

angular-spring-sse-sample

Demo for using Angular and Spring WebFlux Server Sent Events together
TypeScript
13
star
42

angular-spring-websocket-sample

Demo for using Angular and Spring Reactive WebSocket together
TypeScript
13
star
43

jakartaee-rest-sample

Jakarta EE 10 Rest Sample
Java
12
star
44

java-sandbox

The sandbox for playing the new features introduced in the next generation of Java.
Java
11
star
45

building-restful-apis-with-springmvc-gitbook

Gitbook source of Building RESTful APIs with Spring MVC
11
star
46

jakartaee10-sandbox

Jakarta EE 10 sandbox
Java
10
star
47

helidon-sandbox

Playground of helidon framework
Java
9
star
48

spring-reactive-microservice-sample

Spring Microservice Demo built with Spring 5 newly introduced Reactive stack
Java
9
star
49

spring-cloud-sample

Wires up Microservice with Spring Cloud
Java
9
star
50

spring-security-auth0-sample

Spring Security 5 with OAuth2/OIDC and Auth0 integration example
TypeScript
8
star
51

code-challenges

Code challenges in learning new languages, frameworks, engineering tools, architectures, software design patterns, etc.
Java
8
star
52

angular-es6-sample

AngularJS 1.5+ sample with ECMAScript 2015/ES6, Bootstrap 4 and Webpack
JavaScript
8
star
53

devops-sandbox

DevOps sandbox
Shell
7
star
54

spring-kotlin-dsl-sample

Spring Kotlin DSL, Spring Fu (Jafu, Kofu) demos
Kotlin
6
star
55

maven-archetype-jakartaee9

Maven archetype for Jakarta EE 9
Java
6
star
56

cargotracker-regapp

Cargotracker RegisterApp Client written in JavaFX
Java
5
star
57

seam3-sandbox

Seam 3 Sandbox to demostrate seam3 feature or reproduce my issues
HTML
5
star
58

nestjs-graphql-prisma-sample

Nestjs GraphQL Prisma Example
TypeScript
4
star
59

quarkus-auth0-sample

Secures Quarkus applications with OAuth2/Oidc and Auth0
Java
4
star
60

urlshortener-kotlin

Kotlin
3
star
61

reactor-examples

Reactor/ReactiveStreams sandbox
Java
3
star
62

angular-spring-book

Fullstack development with Angular and Spring(Boot)
Java
3
star
63

micronaut-sandbox

Micronaut playground
Java
3
star
64

angular2-material-sample

Angular 2 sample with Angular CLI, Angular 2 Material etc
TypeScript
3
star
65

click4nb

A NetBeans IDE plugin which provide basic support for the Apache Click framework
Java
3
star
66

angular2-firebase-sample

Angular 2 sample with Angular CLI, AngularFire2, Firebase etc
TypeScript
2
star
67

hantsy

it's me
2
star
68

hantsy.github.io

Personal website
HTML
2
star
69

jakartaee10-starter-boilerplate

Jakarta EE 10 Stater Boilerplate for starting a Jakarta EE 10 project
Java
2
star
70

react-spring-mongo-kotlin

React, Spring Boot, Spring Data Mongo, Kotlin Coroutines Example
Kotlin
1
star
71

nodejs-sandbox

NodeJS sandbox
HTML
1
star
72

contracts-git

Contracts for https://github.com/hantsy/spring-cloud-sample/tree/master/contract-producer-rest-git
Groovy
1
star
73

spring-security-reactive-auth0-sample

Spring Security Reactive and OAuth2(Auth0) Resource Example
Kotlin
1
star
74

kotlin-coroutines-examples

Kotlin Coroutines playground
Kotlin
1
star
75

angular-sandbox

Angular playground for Angular 2+
TypeScript
1
star