Java applications developed using Spring Boot are deployed with the GeneXus Deploy Engine. This article explains the deployment process for local implementation and deployment using Docker images.
Deployment Options
- Docker Deployment
- Local Deployment
When deploying using Docker:
- The Deploy Engine creates a Docker image of your application.
- You can optionally generate Kubernetes metadata by enabling the Generate Kubernetes metadata property.
- If you enable Kubernetes metadata generation, follow the steps outlined in HowTo: Deploy an Application to a Kubernetes cluster.
- As with any Spring Boot application, the URL is determined by the application.properties file.
- You can modify this file to change the URL if needed, as described in Spring Boot in Java Application Development.
The deployment process for Deployment Units containing web applications or services is as follows:
Package Type property= Binaries
- Similar to "Sources" value, a package containing source code and required files is created.
- The Deploy Engine automatically builds the application JAR file.
- The JAR file is placed in a folder parallel to the source code, with the same name but a "_" suffix.
- In the GeneXus IDE, when selecting the Deploy Target for a Spring Boot application, the Application Server combo box is not available. This is because the package includes an embedded Tomcat server, and specifying the Application Server version is not necessary.
- You cannot directly enter the application's Display Name. You can configure this by following the documentation guidelines, such as the one found here: https://www.baeldung.com/spring-boot-context-path
- The Spring Boot framework is not considered in any way for command-line applications in GeneXus. Therefore, deployment units containing only command-line Procedure objects behave in the same way as non-Spring Boot applications. A JAR file is created and executed as usual.
To deploy using MSBuild tasks, see Packaging Java sources.
Note that the createdeploy task for Spring Boot applications does not require specifying the Application Server. This information is only relevant for non-Spring Boot applications.
Note: It is mandatory to pass the DEPLOY_TYPE property to the createdeploy task. It can be either "Sources" or "Binaries".
To automatically create the JAR file, you need to set DEPLOY_TYPE=Binaries. You must pass the DEPLOY_TYPE parameter when running the createdeploy task.
C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /noconsolelogger /nologo /logger:DeployLogger,"C:\fullgx\gx\GeneXus.Deploy.MSBuild.Tasks.dll" /verbosity:quiet /ToolsVersion:4.0 "C:\fullgx\gx\deploy.msbuild" /p:KBPath="c:\fullgx\kb"
/p:KBEnvironment="Java Environment"
/p:KBVersion="kb"
/p:DeploymentUnit="DeploymentUnit1"
/p:ProjectName="DeploymentUnit1_20240509193009"
/p:TargetId="LOCAL"
/p:ObjectNames="WebPanel:WebPanel1"
/p:EXTRA_MSBUILD="C:\fullgx\gx\ApplicationServers\Templates\JavaWeb\msbuild\TomcatContextSettings.msbuild" /p:DeployFullPath="c:\fullgx\kb\JavaModel\Deploy\LOCAL\DeploymentUnit1\20240509193009"
/p:WebSourcePath="c:\fullgx\kb\JavaModel\web"
/p:GX_PROGRAM_DIR="C:\fullgx\gx"
/p:USE_APPSERVER_DATASOURCE="False"
/p:GENERATE_OPEN_API_INTERFACE="False"
/p:DEPLOY_TYPE="BINARIES"
/p:APPLICATION_KEY="MY_KEY"
/p:INCLUDE_GAM="False"
/p:INCLUDE_GXFLOW_BACKOFFICE="True"
/p:APP_UPDATE="NONE"
/p:ENABLE_KBN="False"
/p:TARGET_JRE="9"
/p:PACKAGE_FORMAT="Automatic"
/p:TimeStamp="20240509193009"
/p:AppName="GenexusWebApp" /t:CreateDeploy