I've figured out a solution using VS Code workspace.
You can create a .code-workspace file that references both project folders:
sample.code-workspace
{
"folders": [
{
"path": "A"
},
{
"path": "B"
}
]
}
Opening this workspace file will then display both projects (A and B) side-by-side in the "Java Projects" view, and the Spring Boot Tools
extensions is working.