Learn Spring
by running it.

Open the code behind a question, change it and press Run. It really compiles and runs on our servers, and you see the real output right here. Try an idea, check the result, and learn how Spring actually behaves.

Java 17 · Spring Boot 2.5 · Spring Framework 5.3 · Nothing to install

question/data-managementData Management

Run it: Main calls updateProductStock(1, -5) and prints the stock before and after the call; the [tx] lines show what the transaction manager does in between.

demoProductService.java

package demo;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
 
@Service
public class ProductService {
@Autowired private JdbcTemplate jdbcTemplate;
 
@Transactional
public void updateProductStock(int productId, int quantity) {
String sql = "UPDATE products SET stock = stock - ? WHERE id = ?";
jdbcTemplate.update(sql, quantity, productId);
if (quantity < 0) {
throw new IllegalArgumentException("Quantity cannot be negative");
}
}
}
 
Console

Press Run to replay a real run of this project. The output appears here.

Demo: a replay of real runs of this project. In the editor, your code compiles and runs on our servers.Java 17 · Spring Boot 2.5.15
Try it:
  1. Run the code (next)
  2. Delete @Transactional
  3. Run it again

How it works

Three steps, straight from the question you are studying.

  1. 1Open a question with code

    Questions with runnable code have this link in their header.

  2. 2Press Run

    The code compiles and runs, and the console shows what it prints.

  3. 3Change it and run it again

    Edit any file, run it, compare. Reset brings the original back.

Real code, really running

Nothing is simulated in the editor. Your code runs on Java 17 with Spring Boot 2.5.15 and Spring Framework 5.3, the Spring versions named in the official 2V0-72.22 exam guide.

  1. You press Run

    The project's files leave your browser.

  2. springcertified.com

    Checks that your account may run this code.

  3. Isolated container

    A fresh one for every run compiles the code and starts a real JVM.

  4. Your console

    The output streams back while the program prints it.

Your own sandbox

Open your own project and write any Java or Spring code you want to try. It runs on Java 17 with the versions in the Spring Professional exam guide: Spring Framework 5.3, Spring Boot 2.5 and JUnit 5. Nothing to install.

  • Add, rename and delete files
  • Run any class with a main method, or any JUnit test
  • Your project stays in this browser
Open the sandboxIncluded in full access.

Frequently Asked Questions

Yes. Each time you press Run, the project's files go to our code runner, which compiles them and starts a JVM in a fresh, isolated container. The output comes back as the program prints it. Only the demo on this page is a replay of real runs, so it works without an account.

Full access opens the editor

  • Edit any file in the project
  • Run it as you change it
  • Every question that has code
  • Your own sandbox project

A free account runs the code in the sample questions.

Not affiliated with Broadcom or VMware.