Coder Social home page Coder Social logo

zhangzhong1018 / angularjs-springmvc-sample-boot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hantsy/angularjs-springmvc-sample-boot

0.0 1.0 0.0 429 KB

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

Home Page: https://www.gitbook.com/book/hantsy/build-a-restful-app-with-spring-mvc-and-angularjs/details

License: Apache License 2.0

JavaScript 17.88% HTML 22.04% CSS 0.26% Java 59.82%

angularjs-springmvc-sample-boot's Introduction

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.

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.

angularjs-springmvc-sample-boot's People

Contributors

hantsy avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.