Difficulty: Beginner
Estimated Time: 20 Minutes

The definition of each step of this tutorial can be found at https://github.com/devonfw-tutorials/tutorials/tree/main/devon4j-app.

Feel free to report any errors to us or fix them yourself. Errors can be reported by creating an issue in the tutorials repository. To fix the error fork the repository and create a pull request. Errors in the wiki can be reported and fixed in the tutorial-compiler repository. You can find a description of what to look for when creating a pull request at the devonfw contribution guide: https://devonfw.com/website/pages/community/community.html#community.asciidoc_contributing-to-devonfw. If you want to create a tutorial you can start with the katacoda tutorial and read the description for creating your own tutorials: https://github.com/devonfw-tutorials/tutorials/wiki/Development.

devon4j is the Java stack of devonfw. It allows you to build business applications (backends) using Java technology in a highly efficient and standardized way based on established best-practices.

Prerequisites

  • User should have Java development experience

Learning goals

  • After completing this scenario, you will have learned how to generate Java application using devon4j.

More information about devon4j on https://devonfw.com/website/pages/docs/devon4j.asciidoc.html

Conclusion

In this tutorial you have learnt how to create devon4j application using command line or via Eclipse. Next you can check for other tutorials such as:

  • devon4j- contract first code generation
  • devon4j-Kafka
  • devon4j-security
  • devon4j with Spring JPA
  • devon4j rest services

Generate your Java application with devon4j

Step 1 of 3

Create a new project

A devon4j Sample Application

Note: Startup script will take some time for set up. After that you can proceed further.

If you want to create devon4j application on your local machine there are two ways to do it:

  • In eclipse as shown here

  • Using command line as shown here

Now, you will create sample devon4j application with name sampleapp. This step will guide you on how to do it.

Setting up your Java project

Please change the folder to 'devonfw/workspaces/main'.

cd devonfw/workspaces/main

Now you can use devonfw to setup a Java project for you by executing the following 'devon' command.

devon java create com.example.application.sampleapp

Once sampleapp is created switch to next tab of IDE. In IDE explorer you can see folder structure like devonfw-> workspaces->main->sampleapp .

Sampleapp contains 3 modules i.e api, core and server.

api: It contains API for sampleapp.The API contains the required artifacts to interact with your application via remote services. This can be REST service interfaces, transfer-objects with their interfaces and datatypes but also OpenAPI or gRPC contracts.

core: It is the core of the application.In this module you can write actual business logic with service implementation, as well as entire logic layer and dataaccess layer.

batch: Optional module for batch layer. In this example we have not created it. To add batch module while generating from commandline use -Dbatch=batch parameter. And to generate it from eclipse using maven archetype, enter batch variable value as batch in project creation page.

server: This module bundles the entire app (core with optional batch) typically as a bootified WAR file.

If you want to know more about modules and project structure refer here.