Yes that is all you need, just swap out the barrels. If only for practice the 40 mags will feed the 9mm cartridges. Aftermarket barrels are more expensive. Storm Lake makes a 9mm barrel that fits correctly in the 40 slide, no extra play, but it costs $160. It is better but is it worth double the price of a stock barrel? The stock 9mm barrel in the 40 has been done for many years and it works perfectly. The hard part is finding a supplier like Brownells or Midway USA that have the stock barrels. You can't get them from S&W as they are listed as restricted.
Bob