Documentation Center

Building Java module with Maven POM

Use the Maven POM to creating a basic set up for your Java module.

Procedure

  1. Use the following example as the base for your Java module:
    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     
    
        <modelVersion>4.0.0</modelVersion>
    
        <artifactId>your_module_name</artifactId>
    
    <dependencies>
        <groupId>your_groupID</groupId>
        <version>${project.version}</version>
    </dependencies>
    </project>
    
  2. Use the following template to implement a new class:
    @Component
    @RegisteredViewModels({
            @RegisteredViewModel(viewName = "example_module_jsp", clazz = ExampleModuleEntity.class),
            @RegisteredViewModel(viewName = "example_module_image_jsp", clazz = ExampleModuleEntity.class)
    })
    public class ExampleModuleInitializer extends AbstractInitializer{
    
        @Override
        protected String getAreaName(){
            return "ExampleModule";
        }
    } 
  3. (optional) If you want to use the Spring context, use the Java Configuration and class annotated by @Configuration as show in the following docs.io website.

What to do next

Your base for creating the Jave module is built. You can now can start creating models, controllers, and add custom logic.