Run & Stop the CAP Java Server

Run the CAP Java project using Maven, read the Spring Boot startup output, access OData endpoints at port 8080, and stop the server cleanly.

Run & Stop the CAP Java Server

Start the server

cd bookshop-java
mvn spring-boot:run

First run downloads Maven dependencies (~2-3 minutes). Subsequent runs are much faster.

Understanding the startup output

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::               (v3.x.x)

...
[cds] - model loaded from 2 file(s)
[cds] - connect using SQLite in-memory
[cds] - serving CatalogService { path: '/catalog' }
...
Tomcat started on port(s): 8080
Started Application in 4.321 seconds

Access OData endpoints

http://localhost:8080/catalog/$metadata
http://localhost:8080/catalog/Books
http://localhost:8080/catalog/Books?$top=2

Note: CAP Java defaults to port 8080, not 4004 like CAP Node.js.

Stop the server

Press Ctrl+C in the terminal.

Change the port

In srv/src/main/resources/application.yaml:

server:
  port: 4004

Run with a specific Spring profile

mvn spring-boot:run -Dspring-boot.run.profiles=production

Skip tests during run (faster startup)

mvn spring-boot:run -DskipTests

Useful log levels for debugging

In application.yaml:

logging:
  level:
    com.sap.cds: DEBUG       # show CDS framework internals
    org.springframework: INFO
    root: WARN

Hot reload (devtools)

Add to pom.xml dependencies:

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-devtools</artifactId>
  <optional>true</optional>
</dependency>

Now when you save a Java file, Maven rebuilds and the server restarts automatically — similar to cds watch.

Sign in for progress tracking & Q&A →