In an ocean biome, I saw some seagrass in a cave full of water. The ocean was not connected to it.
Because of the biome and of the water in the cave, I think that the seagrass appears.
In spectator mode, I saw some seagrass in a cave full of water. I pressed F3 and I saw that the biome was Ocean.
1. Find a ocean biome
2. Find a cave full of water
3. You are done!
Environment
Windows 10, Minecraft: Java Edition 1.17 Release Candidate 2
Works as intended. See https://minecraft.fandom.com/wiki/Cave#Underwater_caves