Creating an Across application
On this page, you will:
-
Create a Blank Across project using the Across Initializr.
-
Use Spring Boot Maven Runner to run the application.
Prerequisites
To get started building applications using Across you need at least Java 8 and Maven 3+ installed.
Getting started
To generate an Across application, you can use the Across Initializr.
Go to start.across.dev and select Blank Across application without any modules
under Configuration Presets
.
In the Selected modules and options
check include a default message source
.
Click on Generate Project
, this downloads a zip file containing a Maven project.
Extract the zip file and run the application.
$ mvn spring-boot:run
This will start the Across application including an embedded Tomcat server running on port 8080. Any Across application is made up of a number of modules that are started in order. In the console output you can see the modules being bootstrapped:
INFO --- [ost-startStop-1] c.f.a.c.c.bootstrap.AcrossBootstrapper : --- INFO --- [ost-startStop-1] c.f.a.c.c.bootstrap.AcrossBootstrapper : AcrossContext: DemoApplication (AcrossContext-1) (1) INFO --- [ost-startStop-1] c.f.a.c.c.bootstrap.AcrossBootstrapper : Bootstrapping 2 modules in the following order: INFO --- [ost-startStop-1] c.f.a.c.c.bootstrap.AcrossBootstrapper : 1 - DemoApplicationModule [resources: demo]: class com.foreach.across.core.DynamicAcrossModule$DynamicApplicationModule (2) INFO --- [ost-startStop-1] c.f.a.c.c.bootstrap.AcrossBootstrapper : 2 - AcrossContextPostProcessorModule [resources: AcrossContextPostProcessorModule]: class com.foreach.across.core.AcrossContextConfigurationModule (3) INFO --- [ost-startStop-1] c.f.a.c.c.bootstrap.AcrossBootstrapper : ---
1 | The DemoApplication is the application descriptor for this application. |
2 | The DemoApplicationModule is one of the dynamic across modules.
The application module is automatically created and contains the application specific code.
See the dynamic application module for more information. |
3 | The AcrossContextPostProcessorModule is another default module that is always present in your project.
It facilitates Spring Boot Auto-configuration across different modules, for more information see: Auto-configuration support.
Applications usually don’t need to bother directly with this module. |
Our sample application includes an embedded Tomcat webserver. At the end of the console output you see the port the Tomcat server was started on, along with a final message that indicates the application is fully started.
INFO --- [ restartedMain] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http) INFO --- [ restartedMain] com.example.demo.DemoApplication : Started DemoApplication in 3.36 seconds (JVM running for 7.7)
When using an embedded webserver, the actual webserver is usually started at the very end of the application bootstrap.
You can visit http://localhost:8080
to get the default Tomcat 404 page (since we have an empty application).
We have now created and started a fully functional Across application.
From the console you can shutdown the application again using Ctrl+C
.
Next step
Learn about the application descriptor.