A method of G. Wilson for generating commutative algebras of ordinary differential operators is extended to higher dimensions. Our construction, based on the theory of D-modules, leads to a new class of examples of commutative rings of partial differential operators with rational spectral varieties. As an application, we briefly discuss their link to the bispectral problem and to the theory of lacunas.