A comprehensive Java application example demonstrating integration with the MultiFlexi framework. This application showcases how to build Java-based MultiFlexi applications that can read environment variables and configuration data, process them, and output structured JSON results.
- Environment Variable Processing: Reads MultiFlexi-specific environment variables
- Configuration Management: Uses
.envfiles for local development - JSON Output: Generates structured JSON output for integration with MultiFlexi
- Flexible Output: Supports both console output and file output
- MultiFlexi Integration: Fully compatible with the MultiFlexi application framework
- Features
- Prerequisites
- Installation
- Configuration
- Usage
- Environment Variables
- MultiFlexi Integration
- Building
- Contributing
- License
- Java 21 or higher
- Maven 3.6+
- MultiFlexi framework (for production deployment)
-
Clone the repository:
git clone https://github.com/VitexSoftware/MultiFlexi-Java-App-Example.git cd MultiFlexi-Java-App-Example -
Build the project:
mvn clean compile
-
Create a
.envfile (optional for local development):cp .env.example .env # Edit .env with your configuration
The application can be configured using environment variables or a .env file. Create a .env file in the project root:
# MultiFlexi Configuration
MULTIFLEXI_VERSION=1.0.0
MULTIFLEXI_COMPANY_ID=1
MULTIFLEXI_RUNTEMPLATE_ID=1
MULTIFLEXI_APPLICATION_UUID=d4b3fdf8-98ce-442c-bb25-e5f91965a08b
MULTIFLEXI_APPLICATION_ID=java-example
MULTIFLEXI_JOB_ID=12345
MULTIFLEXI_COMPANY_NAME="Example Company"
MULTIFLEXI_EXECUTOR=java-executor
MULTIFLEXI_APPLICATION_NAME="Java App Example"
MULTIFLEXI_RUNTEMPLATE_NAME="Example Template"
MULTIFLEXI_COMPANY_CODE=EXAMPLE
# Logging Configuration
EASE_LOGGER=console
# Output Configuration
RESULT_FILE=java-example_report.jsonUsing Maven:
mvn exec:javaUsing compiled JAR:
java -jar target/mutliflexi_java_app_example-1.0-SNAPSHOT.jarWith environment variables:
MULTIFLEXI_COMPANY_NAME="My Company" RESULT_FILE=output.json java -jar target/mutliflexi_java_app_example-1.0-SNAPSHOT.jarThe application will output a JSON structure containing all MultiFlexi environment variables:
{
"MULTIFLEXI_VERSION": "1.0.0",
"MULTIFLEXI_COMPANY_ID": "1",
"MULTIFLEXI_RUNTEMPLATE_ID": "1",
"MULTIFLEXI_APPLICATION_UUID": "d4b3fdf8-98ce-442c-bb25-e5f91965a08b",
"MULTIFLEXI_APPLICATION_ID": "java-example",
"MULTIFLEXI_JOB_ID": "12345",
"MULTIFLEXI_COMPANY_NAME": "Example Company",
"MULTIFLEXI_EXECUTOR": "java-executor",
"MULTIFLEXI_APPLICATION_NAME": "Java App Example",
"MULTIFLEXI_RUNTEMPLATE_NAME": "Example Template",
"MULTIFLEXI_COMPANY_CODE": "EXAMPLE",
"EASE_LOGGER": "console"
}| Variable | Description | Required | Default |
|---|---|---|---|
MULTIFLEXI_VERSION |
MultiFlexi framework version | No | - |
MULTIFLEXI_COMPANY_ID |
Unique company identifier | No | - |
MULTIFLEXI_RUNTEMPLATE_ID |
Run template identifier | No | - |
MULTIFLEXI_APPLICATION_UUID |
Application UUID | No | - |
MULTIFLEXI_APPLICATION_ID |
Application identifier | No | - |
MULTIFLEXI_JOB_ID |
Job execution identifier | No | - |
MULTIFLEXI_COMPANY_NAME |
Company display name | No | - |
MULTIFLEXI_EXECUTOR |
Executor name | No | - |
MULTIFLEXI_APPLICATION_NAME |
Application display name | No | - |
MULTIFLEXI_RUNTEMPLATE_NAME |
Run template display name | No | - |
MULTIFLEXI_COMPANY_CODE |
Company code | No | - |
EASE_LOGGER |
Logging method (console/syslog) | No | console |
RESULT_FILE |
Output file path | No | stdout |
APP_DEBUG |
Enable debug mode | No | false |
This application is designed to work seamlessly with the MultiFlexi framework. The included MultiFlexi configuration file (multiflexi/abraflexi_java_app.multiflexi.app.json) defines:
- Application Metadata: Name, description, and UUID
- Environment Variables: Configuration options and their types
- Executable Information: How MultiFlexi should run the application
{
"$schema": "https://raw.githubusercontent.com/VitexSoftware/php-vitexsoftware-multiflexi-core/refs/heads/main/multiflexi.app.schema.json",
"schemaVersion": "3.2.1",
"uuid": "d4b3fdf8-98ce-442c-bb25-e5f91965a08b",
"name": "",
"description": {
"en": "Java App Example for AbraFlexi",
"cs": "Java App Example for AbraFlexi"
},
"executable": "java"
}mvn clean compilemvn clean packagemvn testmvn javadoc:javadocMultiFlexi-Java-App-Example/
βββ src/
β βββ main/
β βββ java/
β βββ com/
β βββ vitexsoftware/
β βββ example/
β βββ ExampleApp.java # Main application class
βββ multiflexi/
β βββ abraflexi_java_app.multiflexi.app.json # MultiFlexi configuration
βββ target/ # Compiled classes and JARs
βββ pom.xml # Maven configuration
βββ LICENSE # MIT License
βββ README.md # This file
βββ WARP.md # Working AI Reference
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow Java coding conventions
- Add tests for new functionality
- Update documentation as needed
- Ensure all tests pass before submitting PR
This project is licensed under the MIT License - see the LICENSE file for details.
This project is developed and maintained by Vitex Software.
- Website: https://vitexsoftware.com
- GitHub: https://github.com/VitexSoftware
- Contact: [email protected]
- MultiFlexi Core - The main MultiFlexi framework
- AbraFlexi - PHP library for AbraFlexi integration
Happy coding! π