LED recessed light J-boxes
You'll need to mount them to something substantial
NEC 314.23 requires all junction boxes to be securely and rigidly supported, whether it be by mounting to the face of a wall, attachment to a structural member, &quot;old work&quot; clamps into a finished surface, a pair of rigid conduits, or being embedded into cement or brick.  So, your inspector was bang on in calling out your floppy boxes for a fix, even if they didn't have the Code cite on the tip of their tongue.