Make this stuffing with an apple variety that holds its shape rather than turns to sauce during the cooking process, so there will be tender bites of fruit throughout. Honeycrisp, Granny Smith or Pink Lady are all easy-to-find options.
Preheat oven to 275°F. Spread bread on a large baking sheet. Bake until dry to the touch, about 30 minutes. Transfer to a large bowl.
Increase oven temperature to 350°F. Coat a 9-by-13-inch baking dish with cooking spray.
Heat oil in a large skillet over medium-high heat. Add celery and shallots; cook, stirring often, until just starting to brown, 3 to 5 minutes. Reduce heat to medium and cook, stirring often, until tender, 3 to 5 minutes more. Add apple and garlic; cook, stirring, for 30 seconds. Add rosemary and sage; cook, stirring, for 30 seconds. Scrape the mixture on top of the bread. Melt butter in the pan, scraping up any browned bits, then scrape onto the bread. Add broth, cranberries, walnuts, salt and pepper to the bread mixture and stir to combine. Transfer to the prepared baking dish and press with the back of a large spoon into an even layer. Coat one side of a piece of foil with cooking spray and cover the stuffing, sprayed-side down.
Bake the stuffing for 30 minutes. Uncover and continue baking until the top is golden brown, 20 to 30 minutes more.
To make ahead: Refrigerate stuffing (Steps 1-3) for up to 1 day. Let stand at room temperature while the oven preheats before baking.