+
Skip to content

gpaulo00/spring-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 Spring Boot Demo Application

Java Spring Boot Maven Vue.js License

A modern web application built with Spring Boot and Vue.js that demonstrates best practices in full-stack development, REST API architecture, and frontend-backend integration.

📋 Table of Contents

✨ Features

  • 🏗️ REST API Architecture - Well-structured RESTful API following best practices
  • 🔄 Hot Reload - Agile development with automatic reload in frontend and backend
  • 📊 Dual Database - H2 for development, PostgreSQL for production
  • 🧪 Comprehensive Testing - Unit and integration tests with full coverage
  • 📚 Automatic Documentation - Auto-generated API documentation
  • 🎨 Modern Frontend - Reactive interface with Vue.js and Webpack
  • 🔧 Automated Build - Build pipeline with Maven and frontend tools

🛠️ Technologies

Backend

  • Java 8 - Main programming language
  • Spring Boot 2.0 - Primary framework for web development
  • Spring Data JPA - Data persistence and management
  • Maven - Dependency management and build tool
  • H2 Database - Embedded database for development
  • PostgreSQL - Relational database for production

Frontend

  • Vue.js 2.x - Reactive JavaScript framework
  • Webpack - JavaScript module bundler
  • Yarn - JavaScript package manager
  • Node.js 9.5 - JavaScript runtime

Testing & Documentation

  • JUnit - Unit testing framework
  • Spring Boot Test - Integration testing
  • AsciiDoc - API documentation

🏛️ Architecture

src/
├── main/
│   ├── java/                 # Java source code
│   ├── resources/            # Configuration resources
│   ├── webapp/              # Vue.js frontend application
│   └── asciidoc/            # API documentation
└── test/
    └── java/                # Unit and integration tests

The application follows a separation of concerns architecture:

  • Controller Layer: HTTP request and response handling
  • Service Layer: Business logic
  • Repository Layer: Data access with Spring Data JPA
  • Frontend: SPA with Vue.js communicating via REST API

🚀 Installation

Prerequisites

  • Java 8 or higher
  • Maven 3.6+
  • Node.js 9.5+
  • Yarn 1.5+

Clone the repository

git clone https://github.com/your-username/spring-demo.git
cd spring-demo

Install dependencies

# Backend dependencies
mvn clean install

# Frontend dependencies (if webapp exists)
cd src/main/webapp
yarn install
cd ../../..

💻 Usage

Development with Hot Reload

  1. Start the backend server:
mvn spring-boot:run
  1. Start the frontend server (in another terminal):
cd src/main/webapp
yarn start
  1. Access the application:

Production Build

# Build the complete project
mvn package

# Run the generated JAR
java -jar target/spring-demo-0.1.1.jar

📖 API Documentation

The REST API documentation is automatically generated and available at:

Generate documentation manually:

mvn prepare-package

🧪 Testing

Run all tests:

mvn verify

Unit tests only:

mvn test

Integration tests only:

mvn failsafe:integration-test

Code coverage:

mvn jacoco:report

🚢 Deployment

Environment Variables for Production

# Database
export SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:5432/springdemo
export SPRING_DATASOURCE_USERNAME=your_username
export SPRING_DATASOURCE_PASSWORD=your_password

# Spring Profile
export SPRING_PROFILES_ACTIVE=production

Docker (Optional)

FROM openjdk:8-jre-slim
COPY target/spring-demo-0.1.1.jar app.jar
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "/app.jar"]

🤝 Contributing

  1. Fork the project
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📝 Developer Notes

This project demonstrates:

  • Clean architecture and separation of concerns
  • Full-stack integration between Spring Boot and Vue.js
  • Best practices in modern web development
  • Comprehensive testing and automatic documentation
  • CI/CD ready pipeline with Maven
  • Dual configuration for development and production

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.


Like this project? Give it a star on GitHub!

📧 Contact: your-email@example.com | LinkedIn | Portfolio

About

A basic webapp written using Spring Boot

Resources

Stars

Watchers

Forks

Packages

No packages published
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载