diff --git a/README.md b/README.md index 2c51fd1..33c3115 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,822 @@ -# CIB seven - Getting Started with CIB seven and Spring Boot -This Repository contains the example Spring Boot application for the guide at [docs.cibseven.org](https://docs.cibseven.org/get-started/spring-boot/). + +# Introduction to the Integration Project of CIB Seven Platform and Spring Boot +## project background +With the acceleration of enterprise digital transformation, the demand for efficient, flexible, and scalable technology architecture is increasing day by day. As an important business support system wiSSthin the enterprise, the CIB Seven platform needs to be deeply integrated with modern development frameworks and technologies to improve development efficiency, system performance, and maintainability. Spring Boot, as a popular Java development framework, has become the preferred choice for enterprise application development due to its simple configuration, rich ecosystem, and powerful performance. -This project requires Java 17. +## Project objectives +This project aims to deeply integrate the CIB Seven platform with the Spring Boot framework to achieve the following goals: -Every step of the tutorial was tagged in this repository. You can jump to the final state of each step -by the following command: +Improve development efficiency: Utilize the automatic configuration and rapid development features of Spring Boot to reduce developers' configuration and coding work, and accelerate project delivery. +Enhance system performance: Improve system response speed and throughput through Spring Boot's performance optimization and asynchronous processing mechanism. +Improve maintainability: With the modular design and rich ecosystem tools of Spring Boot, simplify the system maintenance and upgrade process. +Promote technological innovation: Introduce new technologies and features of Spring Boot to drive technological and business innovation on the CIB Seven platform. +## Integrated Content +This project mainly covers the integration of the following aspects: +Basic framework integration: Spring Boot is used as the basic development framework for the CIB Seven platform, replacing the original development framework to achieve rapid development and efficient operation and maintenance. +Data Access Integration: Utilizing persistence layer frameworks such as Spring Data JPA or MyBatis to simplify the development of the data access layer and improve data access efficiency. +Security Framework Integration: Integrate security frameworks such as Spring Security or Shiro to enhance system security and protect enterprise data and user information. +Message queue integration: Introducing message queue middleware such as RabbitMQ and Kafka to achieve asynchronous communication and decoupling between systems, improving system scalability and reliability. +Cache integration: Integrate Redis, Ehcache and other caching middleware to improve system performance and response speed, and reduce database access pressure. +Log management integration: Utilize Spring Boot's log management framework, such as Logback or Log4j2, to achieve unified management and analysis of logs. +## expected results +### Through the implementation of this project, it is expected to achieve the following results: + +Significant improvement in development efficiency: Developers can complete business function development and testing more quickly, shortening project delivery cycles. +The system performance has been significantly enhanced: the response speed and throughput of the system have been significantly improved, meeting the high concurrency and high load business needs of enterprises. +Significant improvement in maintainability: The modularity and configurability of the system have been enhanced, reducing maintenance costs and improving the scalability and reusability of the system. +Continuous promotion of technological innovation: Introducing new technologies and features to drive technological and business innovation on the CIB Seven platform, enhancing the competitiveness of enterprises. + +## summarize +The integration project between CIB Seven platform and Spring Boot is an important step in the digital transformation of enterprises. Through deep integration, the technical advantages of Spring Boot will be fully utilized to enhance the development efficiency, system performance, and maintainability of the CIB Seven platform, providing strong technical support for the sustainable development of enterprises. + +summarize +The integration project between CIB Seven platform and Spring Boot is an important step in the digital transformation of enterprises. Through deep integration, the technical advantages of Spring Boot will be fully utilized to enhance the development efficiency, system performance, and maintainability of the CIB Seven platform, providing strong technical support for the sustainable development of enterprises. + + + + + + +## Functional Features + +### Core Module +- **Pre-configured Maven Build** + - Built-in Spring Boot 3.1.5, Spring Web 6.0.13, Spring Data JPA 3.1.5 + - Integrated Lombok 1.18.28 to simplify POJO development + - Automatically generated `.gitignore` and `HELP.md` files +- **Example REST API Interface** + - `/api/v1/hello` (GET): Returns a welcome message in JSON format + - `/api/v1/users` (POST): User registration API (see example request body below) + - Global exception handling: supports status codes such as `404` (resource not found), `500` (server error), etc. +- **Security and Monitoring** + - Integrated Spring Security 6.1.5 basic configuration + - Actuator endpoints open `/health` and `/info` +### DevOps Integration +- **CI/CD Pipeline** + - GitHub Actions Configuration: + - `build.yml`: Automatically compiles and runs unit tests + - `codeql-analysis.yml`: Code security scanning (triggered weekly) + - SonarQube code quality inspection (needs to configure `sonar-project.properties` yourself) +- **Containerization Support** + - Multi-stage build `Dockerfile` (optimized image size to <150MB) + - `docker-compose.yml` template integrating PostgreSQL and Redis +### Development Tools + - Pre-configured Swagger UI documentation (access path: `/swagger-ui.html`) + - H2 in-memory database configuration (enabled by default in the development environment) + - Flyway database migration script template (located in `src/main/resources/db/migration`) +## Environmental Requirements +### Necessary Tools +| Tool Name | Minimum Version | Verification Command | +|----------------|------------|---------------------------| +| Java | 17 | `java -version` | +| Maven | 3.8.6 | `mvn -v` | + +### Optional Tools +| Tool Name | Recommended Version | Purpose Description | +|----------------|------------|---------------------------| +| Docker | 24.0.6 | Containerized deployment | +| PostgreSQL | 15.3 | Production environment database | +| IntelliJ IDEA | 2023.2 |IDE integrated support | + +## Installation and Quick Start +### Basic Deployment +### Basic Deployment +1. Clone the repository and enter the directory: + ```bash + git clone https://github.com/cibseven/cibseven-get-started-springboot.git + cd cibseven-get-started-springboot +Compilation project: +bash +mvn clean install -DskipTests + +Start the application: +bash +mvn spring-boot:run -Dspring-boot.run.profiles=dev + +Verify running statusCheck health status: +bash +curl http://localhost:8080/actuator/health +Expected output: {"status":"UP"} + +Test example interface: +bash +# Example of a GET request +curl http://localhost:8080/api/v1/hello +# POST request example (User registration) +curl -X POST -H "Content-Type: application/json" \ +-d '{"name":"testUser", "email":"test@example.com"}' \ +http://localhost:8080/api/v1/users +Advanced Configuration +Environment variable override +Variable name default value application scenario +SPRING_DATASOURCE_URL jdbc:h2:mem:test, replace with the PostgreSQL connection string for the production environment. +LOGGING_LEVEL_ROOT INFO can be set to DEBUG during debugging +Docker Production Deployment + +Building the image: +bash +docker build --build-arg JAR_FILE=target/*.jar -t springboot-prod . + +Running container (binding to external database): +bash +docker run -d -p 8080:8080 \ +-e SPRING_DATASOURCE_URL=jdbc:postgresql://host.docker.internal:5432/mydb \ +springboot-prod + +Multi-environment configuration +application-dev.properties: Development environment (default activated) +application-prod.properties: Production environment (requires activation through -Dspring.profiles.active=prod) +Contribution Guide +Development process +Branch Naming Conventions: +Feature development: feat/descriptive name (e.g., feat/add-payment-module) +Defect Fix: fix/issue number (e.g. fix/#123) +Submission message format: +* Detailed description +* Related issue number (e.g., closes #456) +Type labels: feat, fix, docs, refactor, test + +Code review must be approved by at least one core member. + +Use the Files changed tab on GitHub to make line comments. + +Test requirementsNew features must include unit tests (JUnit 5 Mockito) + +Integration testing needs to be configured in src/test/resources/application-test.properties. + +Document resources Core references Resource type link +Complete Guide to Spring Boot Annotations https://docs.spring.io/spring-boot/docs/current/reference/html/ +Best Practices for Docker https://docs.docker.com/develop/develop-images/dockerfile_best-practices/ +Community resources: Stack Overflow tags: spring-boot, docker + +Chinese Forum: Spring China Community: https://spring.io/community-china + +Open Source China Spring Boot SectionTroubleshootingFrequently Asked QuestionsPort Conflict: +Modify SERVER_PORT or terminate the process occupying the port: +bash +lsof -i :8080 && kill -9 + +Dependency download failed: +Configure Maven mirror source (edit ~/.m2/settings.xml): + xml + + aliyun-maven + * + 阿里云仓库 + https://maven.aliyun.com/repository/public + + ..... + + + +User Guide - Configuration + Yang Wenhua +Areas of Contribution: +Analysis of Core Configuration Items +Camunda Integration Configuration +CIB Seven Service Connection +Multi-environment Management + +```markdown +# CIBSeven Integration Configuration Center + +[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT) +[![Spring Boot](https://img.shields.io/badge/Spring%20Boot-3.1-green.svg)](https://spring.io/projects/spring-boot) + +## Key Features + +- **Out-of-the-box** Pre-configured Camunda workflow engine and CIB Seven connectivity +- **Secure Communication** AES256 encryption with sensitive data protection +- **Multi-environment Management** One-click switching between dev/test/prod +- **Monitoring Ready** Integrated Spring Actuator health checks +- **Auto Deployment** BPMN process auto-loading mechanism + +## Quick Start + +### Prerequisites +- JDK 17+ +- Camunda 7.18+ +- MySQL 8.0+/PostgreSQL 14+ + +### Setup Steps +1. Clone repository +```bash +git clone https://github.com/yourorg/cibseven-config.git ``` -git checkout -f Step-X + +2. Set environment variables +```bash +export CIB_API_KEY=your_dev_key +export MAIL_PASSWORD=your_smtp_pass ``` -If you want to follow the tutorial along please clone this repository and checkout the `Start` tag. +3. Start development environment +```bash +mvn spring-boot:run -Dspring.profiles.active=dev +``` +## System Architecture + +```mermaid +graph TD + A[Application] --> B{Environment Config} + B -->|dev| C[Dev Settings] + B -->|prod| D[Prod Settings] + C --> E[Auto-Deploy] + D --> F[Encrypted Comm] + E --> G[Camunda Engine] + F --> H[CIB Seven Platform] +``` + +## Configuration Guide + +### Basic Configuration +```yaml +# application.yaml +server: + port: 8080 +spring: + application: + name: cibseven-integration + profiles: + active: dev # Default environment + +cibseven: + platform: + base-url: https://api.cibseven.com/v1 + api-key: ${CIB_API_KEY:default_dev_key} # Use encryption in production ``` -git clone https://github.com/cibseven/cibseven-get-started-spring-boot.git -git checkout -f Start + +### Camunda Configuration +```yaml +camunda.bpm: + admin-user: # Dev environment only + id: demo + password: demo + database: + schema-update: true # Auto DB schema sync + auto-deployment-enabled: true # BPMN auto-deploy ``` + License: The source files in this repository are made available under the [Apache License Version 2.0](./LICENSE). + + + + +## Advanced Feature Exploration + +This section demonstrates advanced capabilities beyond basic Spring Boot usage, focusing on enterprise-grade enhancements. + +### 1. Enterprise-Grade Security Hardening +Implement OAuth2.0 + JWT authentication flow for API protection. + +**Technical Stack**: +- Spring Security 6.x +- JJWT (Java JWT Library) +- OAuth2 Resource Server + +**Configuration Steps**: +```yaml +# application.yml (security configuration) +security: + oauth2: + resourceserver: + jwt: + issuer-uri: https://auth-server.example.com + jwk-set-uri: ${issuer-uri}/.well-known/jwks.json + +@Configuration +@EnableWebSecurity +public class SecurityConfig { + @Bean + public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { + http + .authorizeHttpRequests(auth -> auth + .requestMatchers("/api/public/**").permitAll() + .anyRequest().authenticated() + ) + .oauth2ResourceServer(OAuth2ResourceServerConfigurer::jwt); + return http.build(); + + } +} + +@RestController +public class ReactiveController { + private final SensorRepository repository; + + public ReactiveController(SensorRepository repository) { + this.repository = repository; + } + + @GetMapping(value = "/stream", produces = MediaType.TEXT_EVENT_STREAM_VALUE) + public Flux streamData() { + return repository.findAll() + .delayElements(Duration.ofMillis(500)) + .log("sensor-stream", Level.FINE); + } +} + + + + org.springframework.cloud + spring-cloud-starter-sleuth + + + org.springframework.cloud + spring-cloud-sleuth-zipkin + + + +spring: + zipkin: + base-url: http://localhost:9411 + sleuth: + sampler: + probability: 1.0 + + + chaos: + monkey: + enabled: true + assaults: + - level: 5 + latencyRangeStart: 1000 + latencyRangeEnd: 5000 + latencyActive: true + + + # Optimal GC settings for 8GB heap +-XX:+UseG1GC +-XX:MaxGCPauseMillis=200 +-XX:InitiatingHeapOccupancyPercent=35 + + +spring: + cache: + cache-names: productCache,userCache + caffeine: + spec: maximumSize=500,expireAfterAccess=600s + +# Test CIB seven Integration +## Test Objectives +Verify whether the CIB seven integration works properly, including key functions such as the deployment of process definitions and the start of process instances. Ensure that the system can operate as expected after integrating CIB seven, and the interaction between various components is normal. +## Test Environment +- Operating System: [Windows 10] +- Development Tool: [IntelliJ IDEA 2022.3.2] +- Runtime Environment: [JDK 17, Spring Boot 2.6.7, Camunda BPM 7.15.0] +- Database: [H2 Database 2.1.210] +## Test Steps +1. Create a Test Class: Create the LoanApprovalIntegrationTest.java file under the path src/main/java/org/cibseven/getstarted/loanapproval/ to write specific integration test code. +2. Write Test Code: +```bash +package org.cibseven.getstarted.loanapproval; + +import org.camunda.bpm.engine.RuntimeService; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; + +import static org.assertj.core.api.Assertions.assertThat; + +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@ActiveProfiles("test") +public class PostDeployIntegrationTest { + + @Autowired + private RuntimeService runtimeService; + + @Test + public void shouldStartProcessAfterDeployment() throws Exception { + // Wait for the application to fully start and trigger the PostDeployEvent + Thread.sleep(5000); // Simple waiting, a more elegant waiting mechanism can be used in actual tests + + // Verify whether the process instance has been started + var instances = runtimeService + .createProcessInstanceQuery() + .processDefinitionKey("loanApproval") + .list(); + + assertThat(instances).isNotEmpty(); + assertThat(instances.size()).isEqualTo(1); + } +} +``` +3. Add the dependency in the pom.xml. +```bash + + org.assertj + assertj-core + test + + + org.junit.jupiter + junit-jupiter-engine + test + +``` +4. Configure the Test Environment: Add the following configuration information to the application.yaml file in the src/test/resources directory: +```bash +spring: + datasource: + url: jdbc:h2:mem:test;DB_CLOSE_DELAY=-1 + driver-class-name: org.h2.Driver + username: sa + password: +camunda: + bpm: + auto-deployment-enabled: false +logging: + level: + org.camunda.bpm: DEBUG +``` +5. Execute the Test: Use the test runner of the IDE to run the test methods in the LoanApprovalIntegrationTest class; or use the project build tool (such as the mvn test command of Maven) to execute the test. +## Expected Results +- In the shouldDeployProcessDefinition test method, the process definition with the key "loanApproval" can be obtained, and the assertion verifies that the process definition is not null, and the test passes. +- In the shouldStartProcessInstance test method, the process instance with the key "loanApproval" can be successfully started, and the assertion verifies that the process instance is not null and the process definition ID is not null, and the test passes. + +## Advanced Configuration + +### Thread Pool Optimization +```yaml +spring: + task: + execution: + pool: + core-size: 10 + max-size: 50 + queue-capacity: 1000 +``` + +### Email Integration +```yaml +spring: + mail: + host: smtp.cibseven.com + username: ${MAIL_USER} + password: ${MAIL_PASSWORD} # Use Jasypt encryption +``` + +## Troubleshooting + +### Processes Not Auto-Deployed +**Symptom**: BPMN files not loading + **Solution**: +1. Verify file location: `resources/processes/` +2. Confirm `.bpmn` extension +3. Validate config: +```yaml +camunda.bpm: + auto-deployment-enabled: true +``` + +### Admin Login Failure +**Symptom**: Can't access Camunda Console + **Solution**: +```yaml +# Production config +camunda.bpm: + admin-user.id: "" # Disable default account + security: + filter-url: /engine-rest/*,/camunda/* +``` + +## Extended Configuration + +### Sensitive Data Encryption +```yaml +cibseven: + platform: + api-key: ENC(AbCdEfG123456) # Jasypt encrypted value + +# Add encryption password at startup +java -jar app.jar --jasypt.encryptor.password=${ENCRYPT_KEY} +``` + +### Multi-Environment Setup +```bash +# Production startup +java -jar app.jar --spring.profiles.active=prod \ + --jasypt.encryptor.password=${PROD_KEY} +``` + + + +CIB Seven Spring Boot Project Installation and Deployment Guide + +1. Environment Preparation +1.1 System Requirements +Operating System: Windows 10+/Linux/macOS + +Java: JDK 17 or later + +Build Tools: Maven 3.6+ or Gradle 7.x + +Database: MySQL 5.7+/PostgreSQL 12+ (depending on project configuration) + +Optional Tool: Camunda Modeler (for editing BPMN files) + +1.2 Install Required Software +Java Installation + +# Linux (Ubuntu/Debian) +sudo apt update +sudo apt install openjdk-17-jdk + +# Windows +# Download and install JDK 17 from https://adoptium.net/ + +# Verify installation +java -version + +Maven Installation + +# Linux (Ubuntu/Debian) +sudo apt install maven + +# Windows +# Download and install from https://maven.apache.org/download.cgi + +# Verify installation +mvn -v + + +2. Obtain Project Code +2.1 Clone Repository + +git clone https://github.com/your-repository/cibseven-springboot-project.git +cd cibseven-springboot-project + +2.2 Check Branch + +git branch -a +git checkout main # or appropriate branch + +3. Database Configuration +3.1 Create Database +Check application.yaml configuration: + +spring: + datasource: + url: jdbc:mysql://localhost:3306/seven_spring_db?useSSL=false&characterEncoding=utf8 + username: springuser + password: springpass + driver-class-name: com.mysql.cj.jdbc.Driver + +Create Database (MySQL) + +-- Execute via MySQL client +CREATE DATABASE IF NOT EXISTS seven_spring_db +DEFAULT CHARACTER SET utf8mb4 +DEFAULT COLLATE utf8mb4_unicode_ci; + +CREATE USER 'springuser'@'%' IDENTIFIED BY 'springpass'; +GRANT ALL PRIVILEGES ON seven_spring_db.* TO 'springuser'@'%'; +FLUSH PRIVILEGES; + +PostgreSQL Example: + +CREATE DATABASE seven_spring_db +ENCODING 'UTF8' +LC_COLLATE 'en_US.UTF-8' +LC_CTYPE 'en_US.UTF-8'; + +CREATE USER springuser WITH PASSWORD 'springpass'; +GRANT ALL PRIVILEGES ON DATABASE seven_spring_db TO springuser; + +4. Project Configuration +4.1 Modify Configuration File +Edit src/main/resources/application.yaml: + +spring: + datasource: + url: jdbc:mysql://localhost:3306/cibseven_db + username: your_username + password: your_password + +cibseven: + api: + base-url: https://api.cibseven.org/v1 + api-key: your_api_key_here + timeout: 5000 + +camunda: + bpm: + database: + schema-update: true + admin-user: + id: admin + password: admin + +4.2 Environment Variables (Optional) +Set environment variables to override sensitive data: + + +export SPRING_DATASOURCE_PASSWORD=your_db_password +export CIBSVEN_API_KEY=your_api_key + +5. Build the Project +5.1 Build with Maven + +mvn clean install -DskipTests +5.2 Build Docker Image (Optional) +If the project includes a Dockerfile: + + +docker build -t cibseven-app:1.0 . + + +6. Deploy the Project +6.1 Run Locally + +mvn spring-boot:run + +# Or run the packaged JAR +java -jar target/cibseven-getstarted-1.0.0.jar +6.2 Production Deployment +Using Systemd (Linux) +Create a service file at /etc/systemd/system/cibseven.service: + + +[Unit] +Description=CIB Seven Spring Boot Application +After=syslog.target network.target + +[Service] +User=appuser +WorkingDirectory=/opt/cibseven +ExecStart=/usr/bin/java -jar /opt/cibseven/cibseven-getstarted-1.0.0.jar +SuccessExitStatus=143 +Restart=always + +[Install] +WantedBy=multi-user.target +Enable and start the service: + + +sudo systemctl daemon-reload +sudo systemctl enable cibseven +sudo systemctl start cibseven +Using Docker Compose +Create docker-compose.yml: + + +version: '3.8' + +services: + cibseven-app: + image: cibseven-app:1.0 + ports: + - "8080:8080" + environment: + - SPRING_DATASOURCE_URL=jdbc:mysql://db:3306/cibseven_db + - SPRING_DATASOURCE_USERNAME=root + - SPRING_DATASOURCE_PASSWORD=dbpassword + depends_on: + - db + + db: + image: mysql:5.7 + environment: + - MYSQL_ROOT_PASSWORD=dbpassword + - MYSQL_DATABASE=cibseven_db + volumes: + - db_data:/var/lib/mysql + ports: + - "3306:3306" + +volumes: + db_data: +Start services: + + +docker-compose up -d +6.3 Deploy BPMN Models +Steps to Deploy BPMN Models: + +Design & Validate BPMN Model: + +Use tools like Camunda Modeler to create/edit BPMN 2.0 files. + +Validate syntax and export as .bpmn or .bpmn20.xml. + +Deploy to Camunda Engine: + +Via REST API: + + +curl -X POST \ + "http://localhost:8080/engine-rest/deployment/create" \ + -H "Content-Type: multipart/form-data" \ + -F "deployment-name=my-process" \ + -F "deployment-source=local" \ + -F "deploy-changed-only=true" \ + -F "my-process.bpmn=@/path/to/your/model.bpmn" +Via Java Code: + + +@Autowired +private RepositoryService repositoryService; + +public void deployProcess() { + repositoryService.createDeployment() + .addClasspathResource("processes/my-process.bpmn") + .name("My Process Deployment") + .deploy(); +} + + +7. Verify Deployment +7.1 Check Application Status + +curl http://localhost:8080/actuator/health +# Expected output: {"status":"UP"} +7.2 Access Interfaces +Swagger UI (if configured): http://localhost:8080/swagger-ui.html + +Camunda Tasklist: http://localhost:8080/camunda/app/tasklist + +8. Troubleshooting +8.1 Database Connection Issues +Error: Cannot create connection to database server + +Solutions: + +Verify database service is running. + +Check JDBC URL, username, and password in application.yaml. + +8.2 CIB Seven API Authentication Failure +Error: 401 Unauthorized + +Solutions: + +Confirm API key and authentication headers are correct. + +Check API key permissions and expiration. + +8.3 BPMN Deployment Failure +Error: Failed to deploy BPMN model + +Solutions: + +Validate BPMN file syntax using Camunda Modeler. + +Ensure database user has sufficient privileges. + + +9. Upgrade Guide +Pull the latest code: + + +git pull origin main +Rebuild the project: + + +mvn clean install +Restart the service: + + +sudo systemctl restart cibseven +# Or +docker-compose up -d --build + +10. Backup & Recovery +10.1 Database Backup + +mysqldump -u username -p cibseven_db > cibseven_backup_$(date +%F).sql +10.2 Database Restore + +mysql -u username -p cibseven_db < cibseven_backup_2023-01-01.sql + +《————Liu Yichang————》 +Modeling and Process Configuration +Project Structure Conceptual Modeling +Adopt a tree structure to precisely represent the project's file and directory structure. Take the cibseven-get-started-spring-boot repository as the root node, list the src/main directory in detail. Further divide it into subdirectories like java and resources under src/main. Meanwhile, consider.gitignore, LICENSE, NOTICE, README.md, and pom.xml as first-level child nodes at the same level as src/main. This more detailed conceptual model can clearly and comprehensively display the basic constituent elements of the project, which greatly facilitates developers to understand the overall framework of the project. For example, developers can quickly locate the src/main/java directory where the business logic code is stored and the src/main/resources directory where configuration files and other resources are placed through this model. They can also quickly find the pom.xml file that manages project dependencies and build information. +Version Control Modeling +Use a directed graph to model the project's version control situation. Regard each commit as a node, and take the commit information (such as Step-3: deploy and invoke BPMN process, Step 1: setup a Spring Boot application project) as the attribute of the node. Use directed edges to represent the association relationship between commits. Starting from the initial commit (for example, Start: the start of the tutorial), developers can trace the development history of the project along the directed edges. Through this model, developers can check in which commit each functional feature was added and the dependency relationship between different commits, thus making it easier to manage versions and trace problems. +Technical Selection Data Modeling +A concise data model can be constructed to describe the project's technical selection. For instance, define an entity "Project Technical Stack" which has attributes such as "Programming Language" (with a value of Java 17) and "Build Tool" (it can be inferred as Maven based on the pom.xml file). This model helps developers quickly grasp the technical environment on which the project depends. When expanding or maintaining the project, they can accurately determine the technical direction. +Process Configuration +Project Initialization Process +First, check whether Java 17 is installed in the local development environment. If it is not installed, install it according to the guidance of the official documentation. +Open the command-line tool and execute the command git clone https://github.com/cibseven/cibseven-get-started-spring-boot.git to clone the project repository locally. +Then execute git checkout -f Start to switch to the initial development state and get ready for subsequent development according to the tutorial. +Tutorial Learning and Practice Process +According to the sequence of tutorial chapters, from the first step, execute git checkout -f Step-X (X is the number corresponding to the current tutorial step) in the command line to switch to the corresponding code state. +Refer to the external documentation (the guide on docs.cibseven.org), and combine it with the current code state to understand the development objectives and implementation ideas of each step. +Analyze and learn the code in the local development environment. If possible, conduct debugging to deeply understand the code logic. After completing the study of the current step, switch to the next step and continue learning. +Project Building and Deployment Process (assuming Maven is used) +Enter the root directory of the project and open the command-line tool. +Execute the mvn clean install command. Maven will download the relevant dependency packages according to the dependency configuration in the pom.xml file, and compile, test, and package the project. +After the packaging is completed, deploy the generated executable file (such as a JAR package) to the corresponding server environment, like a local test server or a production server, according to the project's deployment requirements. During the deployment process, it may be necessary to configure the running environment of the server, such as JVM parameters. +======= +Spring Boot quick start project template, a full-process toolchain that supports enterprise-level application development. + + + diff --git a/README.zh.md b/README.zh.md new file mode 100644 index 0000000..4178440 --- /dev/null +++ b/README.zh.md @@ -0,0 +1,942 @@ + + + # CIB Seven 平台与 Spring Boot 集成项目简介 +## 项目背景 +随着企业数字化转型的加速,对高效、灵活且可扩展的技术架构需求日益增长。CIB Seven 平台作为企业内部的重要业务支撑系统,需要与现代开发框架和技术进行深度集成,以提升开发效率、系统性能和可维护性。Spring Boot 作为当前流行的 Java 开发框架,以其简洁的配置、丰富的生态和强大的性能,成为企业应用开发的首选。 + +## 项目目标 + +本项目旨在将 CIB Seven 平台与 Spring Boot 框架进行深度集成,实现以下目标: + +提升开发效率:利用 Spring Boot 的自动配置和快速开发特性,减少开发人员的配置和编码工作,加速项目交付。 +增强系统性能:通过 Spring Boot 的性能优化和异步处理机制,提升系统的响应速度和吞吐量。 +提高可维护性:借助 Spring Boot 的模块化设计和丰富的生态工具,简化系统维护和升级过程。 +促进技术创新:引入 Spring Boot 的新技术和新特性,推动 CIB Seven 平台的技术创新和业务创新。 + +集成内容 + +## 集成内容 +本项目主要涵盖以下几个方面的集成: + +基础框架集成:将 Spring Boot 作为 CIB Seven 平台的基础开发框架,替代原有的开发框架,实现快速开发和高效运维。 +数据访问集成:利用 Spring Data JPA 或 MyBatis 等持久层框架,简化数据访问层的开发,提高数据访问效率。 +安全框架集成:集成 Spring Security 或 Shiro 等安全框架,增强系统的安全性,保护企业数据和用户信息。 +消息队列集成:引入 RabbitMQ、Kafka 等消息队列中间件,实现系统间的异步通信和解耦,提高系统的可扩展性和可靠性。 +缓存集成:集成 Redis、Ehcache 等缓存中间件,提升系统的性能和响应速度,减少数据库访问压力。 +日志管理集成:利用 Spring Boot 的日志管理框架,如 Logback 或 Log4j2,实现日志的统一管理和分析。 + +预期成果 + +## 预期成果 + +通过本项目的实施,预期将取得以下成果: + +开发效率显著提升:开发人员能够更快速地完成业务功能的开发和测试,缩短项目交付周期。 +系统性能明显增强:系统的响应速度和吞吐量得到显著提升,满足企业高并发、高负载的业务需求。 +可维护性大幅提高:系统的模块化和可配置性得到增强,降低维护成本,提高系统的可扩展性和可复用性。 +技术创新持续推动:引入新技术和新特性,推动 CIB Seven 平台的技术创新和业务创新,提升企业的竞争力。 + +总结 +CIB Seven 平台与 Spring Boot 的集成项目是企业数字化转型的重要一步。通过深度集成,将充分发挥 Spring Boot 的技术优势,提升 CIB Seven 平台的开发效率、系统性能和可维护性,为企业的持续发展提供强有力的技术支撑。 + +## 高级功能探索 + +本章节展示超越基础功能的Spring Boot企业级增强能力,聚焦生产环境实战场景。 + +### 1. 企业级安全加固方案 +实现OAuth2.0+JWT认证体系,构建API安全防护网。 + +**技术栈**: +- Spring Security 6.x +- JJWT令牌库 +- OAuth2资源服务器 + +**配置步骤**: +```yaml +# application.yml 安全配置片段 +security: + oauth2: + resourceserver: + jwt: + issuer-uri: https://auth-server.example.com + jwk-set-uri: ${issuer-uri}/.well-known/jwks.json + + + @Configuration +@EnableWebSecurity +public class SecurityConfig { + @Bean + public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { + http + .authorizeHttpRequests(auth -> auth + .requestMatchers("/api/public/**").permitAll() + .anyRequest().authenticated() + ) + .oauth2ResourceServer(OAuth2ResourceServerConfigurer::jwt); + return http.build(); + } +} + + +@RestController +public class ReactiveController { + private final SensorRepository repository; + + public ReactiveController(SensorRepository repository) { + this.repository = repository; + } + + @GetMapping(value = "/stream", produces = MediaType.TEXT_EVENT_STREAM_VALUE) + public Flux streamData() { + return repository.findAll() + .delayElements(Duration.ofMillis(500)) + .log("sensor-stream", Level.FINE); + } +} + + + + org.springframework.cloud + spring-cloud-starter-sleuth + + + org.springframework.cloud + spring-cloud-sleuth-zipkin + + + +spring: + zipkin: + base-url: http://localhost:9411 + sleuth: + sampler: + probability: 1.0 + + + chaos: + monkey: + enabled: true + assaults: + - level: 5 + latencyRangeStart: 1000 + latencyRangeEnd: 5000 + latencyActive: true + + + # 8GB堆内存优化配置 +-XX:+UseG1GC +-XX:MaxGCPauseMillis=200 +-XX:InitiatingHeapOccupancyPercent=35 + + +spring: + cache: + cache-names: productCache,userCache + caffeine: + spec: maximumSize=500,expireAfterAccess=600s + + +《————刘义昌————》 +建模与流程配置 + +项目结构概念建模 +采用树形结构精确地表示项目的文件和目录结构。以 cibseven-get-started-spring-boot 仓库作为根节点,详细列出 src/main 目录,在 src/main 下进一步细分为 java 和 resources 等子目录,同时将 .gitignore、LICENSE、NOTICE、README.md、pom.xml 作为与 src/main 同级的一级子节点。这种更为细致的概念模型可以清晰且全面地展示项目的基本构成元素,极大地方便开发人员理解项目的整体框架。例如,开发人员能够通过这个模型快速定位到存放业务逻辑代码的 src/main/java 目录,以及存放配置文件等资源的 src/main/resources 目录,同时也能迅速找到管理项目依赖和构建信息的 pom.xml 文件。 + +版本控制建模 +借助有向图来对项目的版本控制情况进行建模。将每一次提交看作一个节点,把提交信息(比如 Step-3: deploy and invoke BPMN process 、Step 1: setup a Spring Boot application project)作为节点的属性,用有向边来表示提交之间的关联关系。从初始提交(例如 Start: the start of the tutorial)开始,沿着有向边就可以追溯项目的开发历程。开发人员通过这个模型,能够查看每个功能特性是在哪个提交中添加的,以及不同提交之间的依赖关系,从而更轻松地进行版本管理和问题的追溯。 + +技术选型数据建模 +可以构建一个简洁的数据模型来描述项目的技术选型。比如,定义一个实体 “项目技术栈”,它拥有 “编程语言”(取值为 Java 17)、“构建工具”(从有 pom.xml 文件可推测为 Maven)等属性。这个模型有助于开发人员快速掌握项目所依赖的技术环境,在进行项目扩展或维护时,能够准确判断技术方向。 + +流程配置 +项目初始化流程 +首先要检查本地开发环境是否安装了 Java 17,要是没有安装,就按照官方文档的指引进行安装操作。 +打开命令行工具,执行 git clone https://github.com/cibseven/cibseven-get-started-spring-boot.git 命令,将项目仓库克隆到本地。 +随后执行 git checkout -f Start 切换到初始开发状态,为按照教程进行后续开发做好准备。 + +教程学习与实践流程 +根据教程的章节顺序,从第一步起,在命令行中执行 git checkout -f Step-X(X 为当前教程步骤对应的数字),切换到相应的代码状态。 +参考外部文档(docs.cibseven.org 上的指南),结合当前的代码状态,理解每一步的开发目标和实现思路。 +在本地开发环境中,对代码进行分析和学习,若条件允许,可以进行调试,以深入理解代码逻辑。完成当前步骤的学习后,切换到下一步继续学习。 + +项目构建与部署流程(假设使用 Maven) +进入项目的根目录,打开命令行工具。 +执行 mvn clean install 命令,Maven 会依据 pom.xml 文件中的依赖配置,下载相关的依赖包,并对项目进行编译、测试和打包。 +打包完成后,依据项目的部署要求,将生成的可执行文件(比如 JAR 包)部署到相应的服务器环境中,如本地测试服务器或生产服务器。在部署过程中,可能需要配置服务器的运行环境,例如 JVM 参数等。 +======= +## 总结 +CIB Seven 平台与 Spring Boot 的集成项目是企业数字化转型的重要一步。通过深度集成,将充分发挥 Spring Boot 的技术优势,提升 CIB Seven 平台的开发效率、系统性能和可维护性,为企业的持续发展提供强有力的技术支撑。 + +# 测试 CIB seven 集成 +## 测试目的 +验证 CIB seven 集成是否正常工作,包括流程定义的部署以及流程实例的启动等关键功能,确保系统在集成 CIB seven 后能够按照预期运行,各组件之间的交互正常。 +## 测试环境 +- 操作系统:[Windows 10 ] +- 开发工具:[IntelliJ IDEA 2022.3.2] +- 运行环境:[JDK 11、Spring Boot 2.6.7、Camunda BPM 7.15.0] +- 数据库:[H2 数据库 2.1.210] +- 验证 CIB seven 集成是否正常工作,包括流程定义的部署以及流程实例的启动等关键功能,确保系统在集成 CIB seven 后能够按照预期运行,各组件之间的交互正常。 +## 测试步骤 +1. 创建测试类:在 src/main/java/org/cibseven/getstarted/loanapproval/ 路径下创建 LoanApprovalIntegrationTest.java 文件,用于编写具体的集成测试代码。 +2. 编写测试代码: +```bash +package org.cibseven.getstarted.loanapproval; + +import org.camunda.bpm.engine.RuntimeService; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; + +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; + +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@ActiveProfiles("test") +public class PostDeployIntegrationTest { + + @Autowired + private RuntimeService runtimeService; + + @Test + public void shouldStartProcessAfterDeployment() throws Exception { + // 等待应用完全启动并触发 PostDeployEvent + Thread.sleep(5000); // 简单等待,实际测试中可使用更优雅的等待机制 + + // 验证是否已启动流程实例 + List instances = runtimeService + .createProcessInstanceQuery() + .processDefinitionKey("loanApproval") + .list(); + + assertThat(instances).isNotEmpty(); + assertThat(instances.size()).isEqualTo(1); + } +} +``` +3. 在pom.xml添加依赖 +```bash + + org.assertj + assertj-core + test + + + org.junit.jupiter + junit-jupiter-engine + test + +``` + +4. 配置测试环境:在 src/test/resources 目录下的 application.yaml 文件中添加以下配置信息: +```bash +spring.datasource.url=jdbc:h2:mem:test;DB_CLOSE_DELAY=-1 +spring.datasource.driver-class-name=org.h2.Driver +spring.datasource.username=sa +spring.datasource.password= +camunda.bpm.auto-deployment-enabled=false +logging.level.org.camunda.bpm=DEBUG +``` +5. 执行测试:使用 IDE 的测试运行器运行 LoanApprovalIntegrationTest 类中的测试方法;或者使用项目构建工具(如 Maven 的 mvn test 命令来执行测试。 + +## 预期结果 +- shouldDeployProcessDefinition 测试方法中,能够获取到键为 "loanApproval" 的流程定义,断言验证流程定义不为空,测试通过。 +- shouldStartProcessInstance 测试方法中,能够成功启动键为 "loanApproval" 的流程实例,断言验证流程实例不为空且流程定义 ID 不为空,测试通过。 + +使用教程 - 配置 + +贡献范围:核心配置项解析、Camunda集成配置、CIB Seven服务连接、多环境管理 + +```markdown +# CIBSeven 集成配置中心 + +[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT) +[![Spring Boot](https://img.shields.io/badge/Spring%20Boot-3.1-green.svg)](https://spring.io/projects/spring-boot) + +## 系统特性 + +- **开箱即用**:预配置Camunda流程引擎与CIB Seven服务连接 +- **安全通信**:支持AES256加密与敏感信息加密存储 +- **多环境管理**:dev/test/prod环境配置一键切换 +- **监控就绪**:集成Spring Actuator健康检查与指标监控 +- **自动部署**:BPMN流程定义文件自动加载机制 + +## 快速开始 + +### 环境要求 +- JDK 17+ +- Camunda 7.18+ +- MySQL 8.0+ / PostgreSQL 14+ + +### 启动步骤 +1. 克隆配置仓库 +```bash +git clone https://github.com/yourorg/cibseven-config.git +``` + +2. 配置环境变量 +```bash +export CIB_API_KEY=your_development_key +export MAIL_PASSWORD=your_smtp_password +``` + +3. 启动开发环境 +```bash +mvn spring-boot:run -Dspring.profiles.active=dev +``` + +## 系统架构 + +```mermaid +graph TD + A[应用服务] --> B{环境配置} + B -->|dev| C[开发配置] + B -->|prod| D[生产配置] + C --> E[自动部署流程] + D --> F[加密通信] + E --> G[Camunda引擎] + F --> H[CIB Seven平台] +``` + +## 配置指南 + +### 基础配置 +```yaml +# application.yaml +server: + port: 8080 +spring: + application: + name: cibseven-integration + profiles: + active: dev # 默认开发环境 + +cibseven: + platform: + base-url: https://api.cibseven.com/v1 + api-key: ${CIB_API_KEY:default_dev_key} # 生产环境必须使用加密存储 +``` + +### Camunda引擎配置 +```yaml +camunda.bpm: + admin-user: # 仅限开发环境使用 + id: demo + password: demo + database: + schema-update: true # 自动同步表结构 + auto-deployment-enabled: true # 自动部署BPMN流程 +``` + +## 高级配置 + +### 线程池优化 +```yaml +spring: + task: + execution: + pool: + core-size: 10 + max-size: 50 + queue-capacity: 1000 +``` + +### 邮件服务集成 +```yaml +spring: + mail: + host: smtp.cibseven.com + username: ${MAIL_USER} + password: ${MAIL_PASSWORD} # 建议使用Jasypt加密 +``` + +## 常见问题 + +### 流程未自动部署 +**现象**:启动后未加载BPMN文件 + **解决方案**: +1. 确认文件位于 `resources/processes/` 目录 +2. 检查文件扩展名为 `.bpmn` +3. 验证配置: +```yaml +camunda.bpm: + auto-deployment-enabled: true # 必须为true +``` + +### 管理员登录失败 +**现象**:无法访问Camunda控制台 + **解决方案**: +```yaml +# 生产环境配置 +camunda.bpm: + admin-user.id: "" # 禁用内置账户 + security: + filter-url: /engine-rest/*,/camunda/* +``` + +## 扩展阅读 + +### 配置加密方案 +```yaml +cibseven: + platform: + api-key: ENC(AbCdEfG123456) # Jasypt加密值 + +# 启动命令添加加密密钥 +java -jar app.jar --jasypt.encryptor.password=${ENCRYPT_KEY} +``` + +### 多环境配置示例 +```bash +# 生产环境启动命令 +java -jar app.jar --spring.profiles.active=prod \ + --jasypt.encryptor.password=${PROD_KEY} +``` + +--- + + +CIB Seven Spring Boot 项目安装部署指南 + +1. 环境准备 +1.1 系统要求 +操作系统: Windows 10+/Linux/macOS + +Java: JDK 17 或更高版本 + +构建工具: Maven 3.6+ 或 Gradle 7.x + +数据库: MySQL 5.7+/PostgreSQL 12+ (根据项目配置) + +可选工具: Camunda Modeler (用于编辑BPMN文件) + +1.2 安装必要软件 +Java 安装 + +# Linux (Ubuntu/Debian) +sudo apt update +sudo apt install openjdk-17-jdk + +# Windows +# 从 https://adoptium.net/ 下载并安装JDK 17 + +# 验证安装 +java -version +Maven 安装 + +# Linux (Ubuntu/Debian) +sudo apt install maven + +# Windows +# 从 https://maven.apache.org/download.cgi 下载并安装 + +# 验证安装 +mvn -v + + +2. 获取项目代码 +2.1 克隆仓库 + +git clone https://github.com/your-repository/cibseven-springboot-project.git +cd cibseven-springboot-project +2.2 检查分支 + +git branch -a +git checkout main # 或适当的分支 +3. 数据库配置 +3.1 创建数据库 +查看 application.yaml 配置 + + +spring: + datasource: + url: jdbc:mysql://localhost:3306/seven_spring_db?useSSL=false&characterEncoding=utf8 + username: springuser + password: springpass + driver-class-name: com.mysql.cj.jdbc.Driver +创建数据库 + + +-- 通过 MySQL 客户端执行 +CREATE DATABASE IF NOT EXISTS seven_spring_db +DEFAULT CHARACTER SET utf8mb4 +DEFAULT COLLATE utf8mb4_unicode_ci; +创建数据库用户并授权 + + +CREATE USER 'springuser'@'%' IDENTIFIED BY 'springpass'; +GRANT ALL PRIVILEGES ON seven_spring_db.* TO 'springuser'@'%'; +FLUSH PRIVILEGES; +PostgreSQL 版本示例: + + +CREATE DATABASE seven_spring_db +ENCODING 'UTF8' +LC_COLLATE 'en_US.UTF-8' +LC_CTYPE 'en_US.UTF-8'; + +CREATE USER springuser WITH PASSWORD 'springpass'; +GRANT ALL PRIVILEGES ON DATABASE seven_spring_db TO springuser; +4. 项目配置 +4.1 配置文件修改 +编辑 src/main/resources/application.yaml: + + +# 数据库配置 +spring: + datasource: + url: jdbc:mysql://localhost:3306/cibseven_db + username: your_username + password: your_password + +# CIB Seven 平台配置 +cibseven: + api: + base-url: https://api.cibseven.org/v1 + api-key: your_api_key_here + timeout: 5000 + +# Camunda 配置 +camunda: + bpm: + database: + schema-update: true + admin-user: + id: admin + password: admin +4.2 环境变量配置 (可选) +可以设置以下环境变量替代配置文件中的敏感信息: + + +export SPRING_DATASOURCE_PASSWORD=your_db_password +export CIBSVEN_API_KEY=your_api_key +5. 构建项目 +5.1 使用 Maven 构建 + +mvn clean install -DskipTests +5.2 构建 Docker 镜像 (可选) +如果项目包含 Dockerfile: + + +docker build -t cibseven-app:1.0 . + + +6. 部署项目 +6.1 本地运行 + +mvn spring-boot:run + +# 或者运行打包后的JAR +java -jar target/cibseven-getstarted-1.0.0.jar +6.2 生产环境部署 +使用 Systemd (Linux) +创建服务文件 /etc/systemd/system/cibseven.service: + + +[Unit] +Description=CIB Seven Spring Boot Application +After=syslog.target network.target + +[Service] +User=appuser +WorkingDirectory=/opt/cibseven +ExecStart=/usr/bin/java -jar /opt/cibseven/cibseven-getstarted-1.0.0.jar +SuccessExitStatus=143 +Restart=always + +[Install] +WantedBy=multi-user.target +然后启用并启动服务: + + +sudo systemctl daemon-reload +sudo systemctl enable cibseven +sudo systemctl start cibseven +使用 Docker Compose +创建 docker-compose.yml: + + +version: '3.8' + +services: + cibseven-app: + image: cibseven-app:1.0 + ports: + - "8080:8080" + environment: + - SPRING_DATASOURCE_URL=jdbc:mysql://db:3306/cibseven_db + - SPRING_DATASOURCE_USERNAME=root + - SPRING_DATASOURCE_PASSWORD=dbpassword + depends_on: + - db + + db: + image: mysql:5.7 + environment: + - MYSQL_ROOT_PASSWORD=dbpassword + - MYSQL_DATABASE=cibseven_db + volumes: + - db_data:/var/lib/mysql + ports: + - "3306:3306" + +volumes: + db_data: +启动服务: + + +docker-compose up -d +6.3部署 BPMN 模型 +部署 BPMN(Business Process Model and Notation)模型通常涉及将设计好的业务流程模型(以 .bpmn 文件格式)加载到流程引擎中,使其能够执行和管理流程实例。以下是详细的部署步骤和注意事项: + +1. 设计并验证 BPMN 模型 +工具选择:使用 BPMN 设计工具(如 Camunda Modeler、Signavio、Eclipse BPMN2 Modeler)创建或编辑 BPMN 2.0 标准的流程图。 + +验证模型:确保模型语法正确(如任务、网关、事件等元素是否符合 BPMN 规范),并导出为 .bpmn 或 .bpmn20.xml 文件。 + +2. 选择流程引擎 +选择一个支持 BPMN 2.0 的流程引擎来部署和执行模型。常见的开源引擎包括: + +Camunda Platform:适合复杂业务流程,提供丰富的管理和监控工具。 + +Flowable:轻量级引擎,支持快速集成。 + +Activiti:由 Alfresco 维护的经典引擎。 + +jBPM:基于 Java 的流程引擎,与 Red Hat 工具链集成。 + +3. 部署到流程引擎 +以 Camunda 为例 +安装流程引擎: + +下载 Camunda 社区版。 + +可嵌入到 Java 应用(如 Spring Boot),或独立部署到 Tomcat/JBoss 服务器。 + +部署 BPMN 模型: + +通过 REST API: + + +curl -X POST \ + "http://localhost:8080/engine-rest/deployment/create" \ + -H "Content-Type: multipart/form-data" \ + -F "deployment-name=my-process" \ + -F "deployment-source=local" \ + -F "deploy-changed-only=true" \ + -F "my-process.bpmn=@/path/to/your/model.bpmn" +通过管理界面: +访问 http://localhost:8080/camunda/app/welcome/,登录后进入 Cockpit,上传 .bpmn 文件。 + +通过代码(Java/Spring Boot): + + +@Autowired +private RepositoryService repositoryService; + +public void deployProcess() { + repositoryService.createDeployment() + .addClasspathResource("processes/my-process.bpmn") + .name("My Process Deployment") + .deploy(); + + +}7. 验证部署 +7.1 检查应用状态 + +curl http://localhost:8080/actuator/health +预期输出: + + +{"status":"UP"} +7.2 访问应用接口 +Swagger UI (如果已配置): http://localhost:8080/swagger-ui.html + +Camunda Tasklist: http://localhost:8080/camunda/app/tasklist + +8. 常见问题解决 +8.1 数据库连接问题 +错误信息: Cannot create connection to database server + +解决方案: + +1. 基础检查 +(1) 数据库服务是否运行? +本地数据库:检查数据库服务是否启动。 + + +# MySQL +systemctl status mysql # Linux +sudo /usr/local/mysql/support-files/mysql.server status # macOS + +# PostgreSQL +systemctl status postgresql +远程数据库:确认目标服务器IP和端口是否可访问。 + + +telnet <数据库IP> 3306 # 测试MySQL端口连通性 +nc -zv <数据库IP> 5432 # 测试PostgreSQL端口 +(2) 连接参数是否正确? +检查 application.properties 中的配置: + +URL格式:确保JDBC URL正确(注意数据库名、端口、SSL配置)。 + + +# 正确示例(MySQL) +spring.datasource.url=jdbc:mysql://localhost:3306/cibseven_db?useSSL=false&serverTimezone=UTC +如果数据库名包含特殊字符(如 -),需用反引号包裹:`cib-seven-db`。 + +用户名/密码:确保无拼写错误,密码是否包含特殊字符(如 @ 需转义为 %40)。 + +8.2 CIB Seven API 认证失败 +错误信息: 401 Unauthorized + +解决方案: + +1. 检查API凭证 +核对密钥/令牌:确认 API Key、Client ID、Secret Key 是否与CIB Seven提供的完全一致(注意大小写、空格或特殊字符)。 + +权限和有效期:确认密钥未被禁用、未过期,且拥有目标API的访问权限。 + +认证方式:检查文档是否要求特定认证方式(如 OAuth 2.0、Bearer Token、Basic Auth)。 + +2. 验证请求头(Headers) +Authorization头格式: + +确保使用正确的格式,例如: + + +Authorization: Bearer +检查是否遗漏Bearer关键字或Token拼接错误。 + +其他必要头字段: + +确认是否遗漏 Content-Type(如 application/json)、X-API-Key 等自定义头。 + +8.3 BPMN 部署失败 +错误信息: Failed to deploy BPMN model + +解决方案: + +1. 检查BPMN模型合法性 +语法错误:确保BPMN文件符合BPMN 2.0规范。 + +使用BPMN Validator或IDE插件(如Camunda Modeler、Eclipse BPMN2插件)检查模型。 + +常见错误:未闭合的网关、缺失的任务定义、无效的连线(Sequence Flow)等。 + +XML格式问题:检查BPMN文件是否为有效XML。 + +使用XML验证工具(如XML Lint)检查标签闭合和属性合法性。 + +重复的ID:确保所有元素的id唯一,避免重复。 + +特殊字符:检查id或name中是否包含非法字符(如空格、特殊符号)。 + +2. 检查部署配置 +资源路径:确认部署时指定的BPMN文件路径正确(绝对路径或相对路径)。 + +权限问题:确保部署用户对目标目录和文件有读写权限。 + +数据库连接: + +检查数据库是否可达(如MySQL、PostgreSQL等)。 + +验证数据库用户权限(如Camunda引擎需要create和alter表的权限)。 + +引擎配置: + +对于Camunda,检查processes.xml或bpm-platform.xml中的自动部署配置。 + +确保引擎版本与BPMN模型兼容(例如,某些新语法需要高版本引擎支持)。 + + +9. 升级指南 +拉取最新代码: + + +git pull origin main +重新构建项目: + + +mvn clean install +重启服务: + + +sudo systemctl restart cibseven +# 或 +docker-compose up -d --build + +10. 备份与恢复 +10.1 数据库备份 + +mysqldump -u username -p cibseven_db > cibseven_backup_$(date +%F).sql +10.2 恢复数据库 + +mysql -u username -p cibseven_db < cibseven_backup_2023-01-01.sql + + Spring Boot 快速启动项目模板,支持企业级应用开发的全流程工具链。 + +--- + +## 功能特性 + +### 核心模块 +- **预配置 Maven 构建** + - 内置 Spring Boot 3.1.5、Spring Web 6.0.13、Spring Data JPA 3.1.5 + - 集成 Lombok 1.18.28 简化 POJO 开发 + - 自动生成 `.gitignore` 和 `HELP.md` 文件 +- **示例 REST API 接口** + - `/api/v1/hello` (GET): 返回 JSON 格式欢迎消息 + - `/api/v1/users` (POST): 用户注册接口(示例请求体见下文) + - 全局异常处理:支持 `404`(资源未找到)、`500`(服务器错误)等状态码 +- **安全与监控** + - 集成 Spring Security 6.1.5 基础配置 + - Actuator 端点开放 `/health` 和 `/info` + +### DevOps 集成 +- **CI/CD 流水线** + - GitHub Actions 配置: + - `build.yml`: 自动编译并运行单元测试 + - `codeql-analysis.yml`: 代码安全扫描(每周定时触发) + - SonarQube 代码质量检测(需自行配置 `sonar-project.properties`) +- **容器化支持** + - 多阶段构建 `Dockerfile`(优化镜像体积至 <150MB) + - `docker-compose.yml` 模板整合 PostgreSQL 和 Redis + +### 开发工具 +- 预置 Swagger UI 文档(访问路径:`/swagger-ui.html`) +- H2 内存数据库配置(开发环境默认启用) +- Flyway 数据库迁移脚本模板(位于 `src/main/resources/db/migration`) + +## 环境要求 + +### 必需工具 +| 工具名称 | 最低版本 | 验证命令 | +|----------------|------------|---------------------------| +| Java | 17 | `java -version` | +| Maven | 3.8.6 | `mvn -v` | + +### 可选工具 +| 工具名称 | 推荐版本 | 用途说明 | +|----------------|------------|---------------------------| +| Docker | 24.0.6 | 容器化部署 | +| PostgreSQL | 15.3 | 生产环境数据库 | +| IntelliJ IDEA | 2023.2 | IDE 集成支持 | + +## 安装与快速启动 + +### 基础部署 +1. 克隆仓库并进入目录: + ```bash + git clone https://github.com/cibseven/cibseven-get-started-springboot.git + cd cibseven-get-started-springboot +编译项目: + +bash +mvn clean install -DskipTests # 跳过测试以加速构建 +启动应用: + +bash +mvn spring-boot:run -Dspring-boot.run.profiles=dev +验证运行状态 +检查健康状态: + +bash +curl http://localhost:8080/actuator/health +预期输出:{"status":"UP"} + +测试示例接口: + +bash +# GET 请求示例 +curl http://localhost:8080/api/v1/hello + +# POST 请求示例(用户注册) +curl -X POST -H "Content-Type: application/json" \ +-d '{"name":"testUser", "email":"test@example.com"}' \ +http://localhost:8080/api/v1/users +高级配置 +环境变量覆盖 +变量名 默认值 应用场景 +SPRING_DATASOURCE_URL jdbc:h2:mem:test 生产环境需替换为 PostgreSQL 连接字符串 +LOGGING_LEVEL_ROOT INFO 调试时可设置为 DEBUG +Docker 生产部署 +构建镜像: + +bash +docker build --build-arg JAR_FILE=target/*.jar -t springboot-prod . +运行容器(绑定外部数据库): + +bash +docker run -d -p 8080:8080 \ +-e SPRING_DATASOURCE_URL=jdbc:postgresql://host.docker.internal:5432/mydb \ +springboot-prod +多环境配置 +application-dev.properties: 开发环境(默认激活) + +application-prod.properties: 生产环境(需通过 -Dspring.profiles.active=prod 激活) + +贡献指南 +开发流程 +分支命名规范: + +功能开发:feat/描述性名称(如 feat/add-payment-module) + +缺陷修复:fix/issue编号(如 fix/#123) + +提交消息格式: + + +* 详细说明 +* 关联的 Issue 编号(如 closes #456) +类型标签:feat、fix、docs、refactor、test + +代码审查 +必须通过至少 1 名核心成员的 Review + +使用 GitHub 的 Files changed 标签进行行级评论 + +测试要求 +新增功能需包含单元测试(JUnit 5 + Mockito) + +集成测试需在 src/test/resources/application-test.properties 中配置 +文档资源 +核心参考 +资源类型 链接 +Spring Boot 注解大全 https://docs.spring.io/spring-boot/docs/current/reference/html/ +Docker 最佳实践 https://docs.docker.com/develop/develop-images/dockerfile_best-practices/ +社区资源 +Stack Overflow 标签:spring-boot、docker + +中文论坛: + +Spring 中国社区:https://spring.io/community-china + +开源中国 Spring Boot 专区 +故障排除 +常见问题 +端口冲突: + +修改 SERVER_PORT 或终止占用端口的进程: + +bash +lsof -i :8080 && kill -9 +依赖下载失败: + +配置 Maven 镜像源(编辑 ~/.m2/settings.xml): + +xml + + aliyun-maven + * + 阿里云仓库 + https://maven.aliyun.com/repository/public + +获取支持 + + + + diff --git a/ai_usage_screenshots/2203303010303_1.png b/ai_usage_screenshots/2203303010303_1.png new file mode 100644 index 0000000..a9fb267 Binary files /dev/null and b/ai_usage_screenshots/2203303010303_1.png differ diff --git a/ai_usage_screenshots/2203303010303_2.png b/ai_usage_screenshots/2203303010303_2.png new file mode 100644 index 0000000..04587ce Binary files /dev/null and b/ai_usage_screenshots/2203303010303_2.png differ diff --git a/ai_usage_screenshots/2203303010303_3.png b/ai_usage_screenshots/2203303010303_3.png new file mode 100644 index 0000000..08eb04c Binary files /dev/null and b/ai_usage_screenshots/2203303010303_3.png differ diff --git a/ai_usage_screenshots/2205308030302_1.png b/ai_usage_screenshots/2205308030302_1.png new file mode 100644 index 0000000..b6e1c6f Binary files /dev/null and b/ai_usage_screenshots/2205308030302_1.png differ diff --git a/ai_usage_screenshots/2205308030302_2.png b/ai_usage_screenshots/2205308030302_2.png new file mode 100644 index 0000000..30b0259 Binary files /dev/null and b/ai_usage_screenshots/2205308030302_2.png differ diff --git a/ai_usage_screenshots/2205308030302_3.png b/ai_usage_screenshots/2205308030302_3.png new file mode 100644 index 0000000..75160e8 Binary files /dev/null and b/ai_usage_screenshots/2205308030302_3.png differ diff --git a/ai_usage_screenshots/2205308030303_1.png b/ai_usage_screenshots/2205308030303_1.png new file mode 100644 index 0000000..ed9dad4 Binary files /dev/null and b/ai_usage_screenshots/2205308030303_1.png differ diff --git a/ai_usage_screenshots/2205308030303_2.png b/ai_usage_screenshots/2205308030303_2.png new file mode 100644 index 0000000..42b78d5 Binary files /dev/null and b/ai_usage_screenshots/2205308030303_2.png differ diff --git a/ai_usage_screenshots/2205308030303_3.png b/ai_usage_screenshots/2205308030303_3.png new file mode 100644 index 0000000..277ae4c Binary files /dev/null and b/ai_usage_screenshots/2205308030303_3.png differ diff --git a/ai_usage_screenshots/2205308030305_1.png b/ai_usage_screenshots/2205308030305_1.png new file mode 100644 index 0000000..02db1f3 Binary files /dev/null and b/ai_usage_screenshots/2205308030305_1.png differ diff --git a/ai_usage_screenshots/2205308030305_2.png b/ai_usage_screenshots/2205308030305_2.png new file mode 100644 index 0000000..42eee1b Binary files /dev/null and b/ai_usage_screenshots/2205308030305_2.png differ diff --git a/ai_usage_screenshots/2205308030305_3.png b/ai_usage_screenshots/2205308030305_3.png new file mode 100644 index 0000000..7ba9f20 Binary files /dev/null and b/ai_usage_screenshots/2205308030305_3.png differ diff --git a/ai_usage_screenshots/2205308030324_1.png b/ai_usage_screenshots/2205308030324_1.png new file mode 100644 index 0000000..f64a5bb Binary files /dev/null and b/ai_usage_screenshots/2205308030324_1.png differ diff --git a/ai_usage_screenshots/2205308030324_2.png b/ai_usage_screenshots/2205308030324_2.png new file mode 100644 index 0000000..bc37a6c Binary files /dev/null and b/ai_usage_screenshots/2205308030324_2.png differ diff --git a/ai_usage_screenshots/2205308030324_3.png b/ai_usage_screenshots/2205308030324_3.png new file mode 100644 index 0000000..cedc07c Binary files /dev/null and b/ai_usage_screenshots/2205308030324_3.png differ diff --git a/ai_usage_screenshots/2205308030345_1.png b/ai_usage_screenshots/2205308030345_1.png new file mode 100644 index 0000000..3fc3190 Binary files /dev/null and b/ai_usage_screenshots/2205308030345_1.png differ diff --git a/ai_usage_screenshots/2205308030345_2.png b/ai_usage_screenshots/2205308030345_2.png new file mode 100644 index 0000000..2d7eb8e Binary files /dev/null and b/ai_usage_screenshots/2205308030345_2.png differ diff --git a/ai_usage_screenshots/2205308030345_3.png b/ai_usage_screenshots/2205308030345_3.png new file mode 100644 index 0000000..1ce2cf9 Binary files /dev/null and b/ai_usage_screenshots/2205308030345_3.png differ diff --git a/ai_usage_screenshots/2205308030356_1.png b/ai_usage_screenshots/2205308030356_1.png new file mode 100644 index 0000000..dc92c48 Binary files /dev/null and b/ai_usage_screenshots/2205308030356_1.png differ diff --git a/ai_usage_screenshots/2205308030356_2.png b/ai_usage_screenshots/2205308030356_2.png new file mode 100644 index 0000000..972e080 Binary files /dev/null and b/ai_usage_screenshots/2205308030356_2.png differ diff --git a/ai_usage_screenshots/2205308030356_3.png b/ai_usage_screenshots/2205308030356_3.png new file mode 100644 index 0000000..1513ec7 Binary files /dev/null and b/ai_usage_screenshots/2205308030356_3.png differ diff --git a/ai_usage_screenshots/2208304030314_1.png b/ai_usage_screenshots/2208304030314_1.png new file mode 100644 index 0000000..b6c1742 Binary files /dev/null and b/ai_usage_screenshots/2208304030314_1.png differ diff --git a/ai_usage_screenshots/2208304030314_2.png b/ai_usage_screenshots/2208304030314_2.png new file mode 100644 index 0000000..aa4ac53 Binary files /dev/null and b/ai_usage_screenshots/2208304030314_2.png differ diff --git a/ai_usage_screenshots/2208304030314_3.png b/ai_usage_screenshots/2208304030314_3.png new file mode 100644 index 0000000..ee44912 Binary files /dev/null and b/ai_usage_screenshots/2208304030314_3.png differ diff --git a/modification_log.md b/modification_log.md new file mode 100644 index 0000000..2617b2e --- /dev/null +++ b/modification_log.md @@ -0,0 +1,99 @@ + + + +#### 2025-5-13 | v1.0.0 | 刘仁炽 +- 对README.zh.md进行完善格式 +- 修改环境变量的一些冲突 +- 对关键词进行一些修改 + + +# 项目修改记录 + +#### 2025-5-13 | v1.0.0 | 杨文华 +- 新增:Camunda基础配置(管理账号、流程过滤器) +- 新增:CIB Seven平台连接参数(API地址、鉴权密钥) +- 新增:多环境Profile配置示例 + +#### 2025-5-13 | v1.1.0 | 杨文华 +- 优化:Camunda流程引擎参数补充(`schema-update`, `history-level`) +- 新增:安全配置建议章节(密钥管理、HTTPS强制要求) +- 修复:`application.yaml`缩进格式统一 + +markdown +# Project Change Log + +## Version History + +### **v1.1.0** | 2025-05-13 | Wenhua Yang +- **Enhancements**: + - Expanded Camunda engine parameters (`schema-update`, `history-level`) + - Added security configuration recommendations (key management, HTTPS enforcement) +- **Fixes**: + - Standardized YAML indentation formatting + +### **v1.0.0** | 2025-05-13 | Wenhua Yang +- **New Features**: + - Camunda core configurations (admin accounts, task filters) + - CIB Seven platform connection parameters (API endpoints, authentication keys) + - Multi-environment Profile configuration examples + +--- + + + +#### 2025-5-13 | v1.0.0 | 覃雄伟 +我在尝试spring boot项目数据库配置时不会配置,然后问了ai,ai教我查看application.yaml配置和创建数据库还有创建数据库用户并授权。 +在数据库链接时出现问题,询问了ai,它教我进行基础检查进行测试。 +当CIB Seven API认证失败时我去问了ai怎么解决,它给我回复解决方案.进行API凭证和验证请求头。 + +#### 2025-5-13 | v1.0.0 | 韩辉 + 我运用AI,先快速收集整合CIB Seven与Spring Boot集成信息,再了解优势内容,经结构化处理、细节补充与校验,高效完成任务,确保内容准确且全面。 +#### 2025-5-13 | v1.0.0 | 张佳 +使用AI详细解释了 CIBseven系统通过REST api进行流程实例启动和任务查询。 +询问AI如何部署 BPMN 模型。 +出现 “Failed to deploy BPMN model” 错误时,通过AI解决部署失败问题。 +英文版README.md(含作者标注) +包含5个企业级功能模块: +OAuth2.0+JWT安全加固(含Spring Security配置) +WebFlux响应式编程升级(含性能对比数据) +Sleuth+Zipkin分布式追踪集成 +Chaos Monkey混沌工程准备 +AI辅助的JVM/缓存调优方案 +每个模块包含: +技术选型说明 +代码配置片段(YAML/Java) +操作验证截图引用 +AI生成内容的标注与验证说明 +中文版README.zh.md(润色版) +保持与英文版完全对应的功能结构 +补充中文技术术语规范表述 +增加性能对比表格等可视化元素 +保留AI建议的特殊标注格式 +术语表terms.md +覆盖11个核心专业术语(中英对照) +包含架构模式(舱壁隔离)、协议标准(OAuth2.0)、工具组件(Sleuth)等多维度术语 +遵循行业术语规范(如保留WebFlux等专有名词英文) +附加术语选择说明文档 +交付物特征: +所有代码片段含作者标识 +包含AI生成内容的验证记录(如DeepSeek建议的JVM参数) +术语表与正文实现双向关联引用 +性能数据采用对比表格呈现 +截图命名遵循学号_功能模块编号规范 +技术深度: +涵盖Spring生态全链路技术栈(安全/响应式/可观测性/韧性工程) +包含混沌工程等前沿DevOps实践 +集成AI驱动的智能调优方案 +验证环节包含压力测试数据(如3200 req/sec吞吐量) +这些文档完整实现了任务要求中的高级功能探索模块,既保证技术深度,又符合团队协作规范,所有AI生成内容均通过双重验证(官方文档校验+团队交叉审核)。 +#### 2025-5-13 | v1.0.0 | 蓝李鹏 +想不到怎么开始做题对AI进行提问做出大概提纲: + +这是一个基于 Spring Boot 的项目,结合了 CIB seven 平台的功能。以下是对项目主要内容的分析: +。。。。。。。。 +此图片是任务要求,我的任务是使用教程项目 + +找不到文档地址使用AI询问如何寻找 + +使用AI帮助翻译句子 + diff --git a/terms.md b/terms.md new file mode 100644 index 0000000..8df4de5 --- /dev/null +++ b/terms.md @@ -0,0 +1,193 @@ +# 术语词汇表 + +## 集成(Integration) +定义:将 CIB Seven 平台与 Spring Boot 框架结合,实现技术架构的升级和优化。 +目标:提升开发效率、系统性能和可维护性。 + +## 持久层框架(Persistence layer framework) +定义:用于数据访问和持久化的框架,如 Spring Data JPA 或 MyBatis。 +作用:简化数据访问层的开发,提高数据操作效率。 + +## 安全框架(Security Framework) +定义:用于保护系统和数据的框架,如 Spring Security 或 Shiro。 +功能:身份验证、授权、数据加密等。 + +## 缓存中间件(cache middleware) +定义:用于存储和快速检索数据的软件,如 Redis、Ehcache。 +作用:提升系统性能,减少数据库访问压力。 + +## 模块化设计(Modular design) +定义:将系统划分为独立的模块,每个模块负责特定功能。 +优势:提高系统的可维护性和可扩展性。 + +## 异步处理(asynchronously) +定义:在后台执行任务,不阻塞主线程。 +应用:提升系统响应速度,改善用户体验。 + +## 技术创新 +定义:引入新技术和新特性,推动平台升级。 +目标:提升企业竞争力,满足业务需求。 +## 总结 +本术语词汇表聚焦于 CIB Seven 平台与 Spring Boot 集成项目中的关键概念和技术词汇,帮助理解项目的技术架构和实现目标。这些术语直接对应项目简介中提到的内容,确保与项目需求紧密相关。 + +建模 +定义:建模是指为了某个特定目的,对现实世界中的对象、系统、过程等进行抽象、简化和结构化表达的过程。它通过建立模型,以数学、图形、文字等多种形式来描述和分析问题,帮助人们更好地理解、预测和控制所研究的对象。 +流程配置 +定义:流程配置是指根据业务需求和目标,对业务流程进行规划、设计、调整和优化的过程。它涉及到确定流程的各个环节、参与人员、执行顺序、输入输出等要素,以确保流程的高效运行和达成预期的业务目标。 + +# 术语表 (Terms Glossary) + +| 英文术语 | 中文翻译及说明 | +|---------------------------|-----------------------------------------------------------------------------| +| **Spring Security** | Spring安全框架:企业级Java安全解决方案,提供认证/授权/攻击防护功能 | +| **OAuth 2.0** | 开放授权2.0:行业标准的授权框架,支持第三方应用安全访问资源 | +| **JWT (JSON Web Token)** | JSON Web令牌:紧凑的URL安全令牌格式,用于声明信息交换(如用户身份) | +| **Reactive Programming** | 响应式编程:基于事件驱动的非阻塞编程范式,适合高并发场景(如WebFlux实现) | +| **Backpressure** | 背压机制:响应式流中控制数据生产速率以防止资源过载的策略 | +| **Distributed Tracing** | 分布式追踪:跨服务调用链的请求跟踪技术(Sleuth+Zipkin实现) | +| **Chaos Engineering** | 混沌工程:通过主动故障注入验证系统容错能力的学科(Chaos Monkey工具) | +| **Circuit Breaker** | 熔断器模式:故障隔离机制,当服务异常时快速失败防止级联崩溃(Resilience4J) | +| **Bulkhead Isolation** | 舱壁隔离:将系统资源分组隔离,限制故障影响范围的安全设计模式 | +| **Adaptive Caching** | 自适应缓存:根据运行时指标动态调整缓存策略的智能缓存机制 | +| **Caffeine Cache** | Caffeine缓存:高性能Java缓存库,支持过期策略和大小限制 | +| **JVM Tuning** | JVM调优:通过GC参数/内存配置优化Java虚拟机性能的技术实践 | +======= + +- 断言:Assertions +- 过程实例启动:Start of Process Instances +- 数据库配置:Database Configuration +- 依赖:Dependency +- CIB seven 集成测试:CIB seven Integration Test + + +# 项目术语说明 + +#### Camunda BPM +流程自动化引擎,用于设计、执行和监控业务流程。 + +#### BPMN (Business Process Model and Notation) +标准化业务流程建模语言,通过图形化界面定义流程节点和逻辑。 + +#### CIB Seven 平台 +金融业务协同平台,提供信用评估、交易处理等标准化API接口。 + +#### Spring Boot Profile +多环境配置机制,通过`application-{env}.yaml`文件区分开发、测试、生产环境参数。 + +#### TLS 加密 +传输层安全协议,用于保障API通信数据的机密性和完整性。 + +#### 流程历史记录级别 +Camunda参数(如`history-level: full`),控制流程实例运行数据的存储粒度。 + +#### 异步任务执行 +Camunda后台任务处理模式,通过`job-execution.enabled`开关控制。 + +# Project Terminology Glossary + +#### Camunda BPM +Process automation engine for designing, executing, and monitoring business workflows. + +#### BPMN (Business Process Model and Notation) +Standardized graphical notation for defining business process logic and workflow structures. + +#### CIB Seven Platform +Financial business collaboration platform offering standardized APIs for credit evaluation, transaction processing, and compliance services. + +#### Spring Boot Profile +Multi-environment configuration mechanism enabling parameter isolation via application-{env}.yaml files (e.g., dev/test/prod). + +#### TLS Encryption +Transport Layer Security protocol ensuring confidentiality and integrity of API communication data. + +#### Process History Level +Camunda configuration parameter (e.g., history-level: full) controlling the granularity of process instance data persistence. + +#### Asynchronous Task Execution +Camunda's background task processing mode governed by the job-execution.enabled configuration toggle. + + +中文术语 | 英文术语 +REST API 接口 | REST API +JSON 格式 |JSON Format +POJO 简化开发 |POJO (Plain Old Java Object) +H2 内存数据库 |H2 In-Memory Database +Flyway 数据库迁移工具 |Flyway Database Migration +Swagger UI 文档 Swagger |UI Documentation +JUnit 5 单元测试框架 |JUnit 5 +Mockito 测试框架 |Mockito +GitHub Actions 配置 | GitHub Actions Configuration +CodeQL 代码安全扫描 |CodeQL Security Scanning +SonarQube 代码质量检测 |SonarQube Code Quality Inspection +多阶段构建 |Multi-stage Build +docker-compose.yml 模板 |docker-compose.yml Template +Redis 数据库 |Redis Database +Actuator 端点 |Actuator Endpoints +环境变量覆盖 |Environment Variable Overrides +多环境配置文件 |Multi-Environment Configuration Files +Spring Profiles 配置 |Spring Profiles +Git 分支命名规范 |Git Branch Naming Conventions +提交消息格式 |Commit Message Format +代码审查流程 |Code Review Process +单元测试 |Unit Testing +集成测试 |Integration Testing +Spring Boot 注解指南 |Spring Boot Annotations Guide +Docker 最佳实践 |Docker Best Practices +Stack Overflow 标签 |Stack Overflow Tags +Spring 中国社区 |Spring China Community +端口冲突解决 |Port Conflict Resolution +Maven 镜像配置 |Maven Mirror Configuration +Maven 编译命令 |Maven Build Command +Docker 生产镜像构建 |Docker Production Image Build +Actuator 端点, 多环境配置 |Actuator Endpoints, Multi-Environment Config +Git 分支规范, 代码审查 |Git Branch Conventions, Code Review +Maven 镜像配置 |Maven Mirror Configuration + +. + +CIB Seven Spring Boot 项目术语词汇表(中英文对照) +中文术语 英文术语/缩写 +应用配置文件 application.yaml Configuration File +数据源配置 Datasource Configuration +API 密钥 API Key +业务流程模型与标注 BPMN (Business Process Model and Notation) +流程实例 Process Instance +Docker 容器编排 Docker Compose +系统服务单元 Systemd Service Unit +数据库备份与恢复 Database Backup & Recovery +流程定义键 Process Definition Key +环境变量注入 Environment Variables Injection +关键术语说明 +BPMN + +中文:业务流程模型与标注 + +用途:标准化的业务流程建模语言,用于设计 Camunda 工作流。 + +Process Instance + +中文:流程实例 + +用途:表示一个具体业务流程的运行实例(如订单审批、请假申请)。 + +API Key + +中文:API 密钥 + +用途:用于身份验证,确保对 CIB Seven 平台 API 的安全访问。 + +Docker Compose + +中文:Docker 容器编排工具 + +用途:通过 YAML 文件定义多容器应用的服务依赖与部署配置。 + +Systemd Service Unit + +中文:系统服务单元 + +用途:在 Linux 系统中管理 Spring Boot 应用的后台服务(启动、监控、重启)。 + + + + diff --git a/test/cibseven-get-started-spring-boot/src/main/java/org/cibseven/getstarted/loanapproval/WebappExampleProcessApplication.java b/test/cibseven-get-started-spring-boot/src/main/java/org/cibseven/getstarted/loanapproval/WebappExampleProcessApplication.java new file mode 100644 index 0000000..123a70a --- /dev/null +++ b/test/cibseven-get-started-spring-boot/src/main/java/org/cibseven/getstarted/loanapproval/WebappExampleProcessApplication.java @@ -0,0 +1,43 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.cibseven.getstarted.loanapproval; + +import org.camunda.bpm.engine.RuntimeService; +import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication; +import org.camunda.bpm.spring.boot.starter.event.PostDeployEvent; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.event.EventListener; + +@SpringBootApplication +@EnableProcessApplication +public class WebappExampleProcessApplication { + + @Autowired + private RuntimeService runtimeService; + + public static void main(String... args) { + SpringApplication.run(WebappExampleProcessApplication.class, args); + } + + @EventListener + public void processPostDeploy(PostDeployEvent event) { + runtimeService.startProcessInstanceByKey("loanApproval"); + } + +} \ No newline at end of file diff --git a/test/cibseven-get-started-spring-boot/src/main/resources/META-INF/processes.xml b/test/cibseven-get-started-spring-boot/src/main/resources/META-INF/processes.xml new file mode 100644 index 0000000..e69de29 diff --git a/test/cibseven-get-started-spring-boot/src/main/resources/application.yaml b/test/cibseven-get-started-spring-boot/src/main/resources/application.yaml new file mode 100644 index 0000000..d7a6a3d --- /dev/null +++ b/test/cibseven-get-started-spring-boot/src/main/resources/application.yaml @@ -0,0 +1,7 @@ +camunda.bpm: + admin-user: + id: demo + password: demo + firstName: Demo + filter: + create: All tasks \ No newline at end of file diff --git a/test/cibseven-get-started-spring-boot/src/main/resources/loanApproval.bpmn b/test/cibseven-get-started-spring-boot/src/main/resources/loanApproval.bpmn new file mode 100644 index 0000000..b43dc9d --- /dev/null +++ b/test/cibseven-get-started-spring-boot/src/main/resources/loanApproval.bpmn @@ -0,0 +1,50 @@ + + + + + SequenceFlow_1 + + + + SequenceFlow_0oy9c54 + + + SequenceFlow_1 + SequenceFlow_0oy9c54 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +