Not recommended for different reasons. Once you spray foam, it is very difficult to do anything else like installing pot lights. Also, spray foam costs are high and the energy savings are the same. You could use spray foam for heating ducts, skylights, and other similar locations though.