In this article, we will delve into the exciting combination of AngularJS as the frontend technology and Spring MVC as the REST API producer, facilitating an enriching user experience and a powerful backend architecture. This guide will help you learn how to set up and run the sample application efficiently.

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

Requirements

To successfully run the application, ensure the following components are installed:

Getting the Source Code

Clone the repository to your local system with the command below:

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

Running the Application

You can run the application using one of the two approaches outlined below:

Method 1: Running Frontend and Backend Separately

  1. Start the backend API server:
  2. mvn spring-boot:run

    The API server listens on port 9000.

  3. Run the frontend UI standalone:
  4. npm install
    bower install
    gulp serve

    By default, this serves on port 3000.

  5. Test the application by opening http://localhost:3000 in your browser.

Method 2: Running via Spring Boot Maven Plugin

  1. Resolve dependencies for the frontend resources:
  2. npm install
    bower install
  3. Run the backend API server and package static resources:
  4. mvn spring-boot:run -Dstatic-ui
  5. Access the application at http://localhost:9000.
  6. For REST API documentation, visit http://localhost:9000/swagger-ui.html.

Generating REST API Documentation

Generate static HTML and PDF documentation for your REST API with the following Maven command:

mvn clean package -Drestdocs

The documentation will be located in the target/asciidoc folder.

Troubleshooting

While running the application, you might encounter some common issues. Here are a few solutions:

  • Problem: Failed to start the backend server.
    Solution: Ensure that the JAVA_HOME environment variable is correctly set.
  • Problem: Frontend failing to load.
    Solution: Make sure all Node.js dependencies are installed by running npm install.
  • Problem: Resource not found on the server.
    Solution: Check your configurations and ensure you’re accessing the correct endpoint.

For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.

Conclusion

With a robust setup involving AngularJS and Spring MVC, this project paves the way for creating dynamic and responsive web applications. At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

About the Author

Hemen Ashodia

Hemen Ashodia

Hemen has over 14+ years in data science, contributing to hundreds of ML projects. Hemen is founder of haveto.com and fxis.ai, which has been doing data science since 2015. He has worked with notable companies like Bitcoin.com, Tala, Johnson & Johnson, and AB InBev. He possesses hard-to-find expertise in artificial neural networks, deep learning, reinforcement learning, and generative adversarial networks. Proven track record of leading projects and teams for Fortune 500 companies and startups, delivering innovative and scalable solutions. Hemen has also worked for cruxbot that was later acquired by Intel, mainly for their machine learning development.

×