CONFIGURACIONES ADICIONALES PARA DESPLIEGUE EN SERVIDOR JBOSS

1. Primero necesitaremos excluir la dependencia tomcat del “spring boot starter web.jar”, debido a que este internamente los incluye.
<dependency>
       <groupId>org.springframework.boot</groupId>
       <artifactId>spring-boot-starter-web</artifactId>
       <exclusions>
             <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-tomcat</artifactId>
             </exclusion>
       </exclusions>
</dependency>

2. Como la dependencia javax.servlet  fue parte del API de tomcat que excluimos en el paso 2, entonces necesitaremos agregar este dependencia externamente solo para el tiempo de compilación ya que JBoss también tiene esta dependencia.
<!-- the implementation will be provided by Wildfly / JBoss -->
<dependency>
       <groupId>javax.servlet</groupId>
       <artifactId>javax.servlet-api</artifactId>
       <scope>provided</scope>
</dependency>

3. Agregar el context path en el archivo application.yml
server:
  port: 8080
  servlet:
    context-path: /siserp-pos-backend

4. Para desplegar el proyecto en JBoss, necesitaremos compilar un .war del proyecto, para esto agregamos lo siguiente en el pom.xml
<packaging>war</packaging>

5. Definir el context-root-path, hay variasformas de definir el context-root-path de  una aplicación en JBoss:
A) Agregar lo siguiente en el tag<build> del pom.xml
<build>
<finalName>siserp-pos-backend</finalName>
...
</build>
 
B) Agregar un archivo jboss-web.xml dentro del directorio /webapp/WEB-INF/jboss-web.xml y agregar las siguientes líneas en el archivo xml.
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
  <context-root>/siserp-pos-backend</context-root>
</jboss-web>
 
Finalmente ejecutar el comando: “mvn clean package” y desplegar el archivo .war generado en JBoss.