
Preheat the oven to 400°F. Fit a 15x10x1-inch baking sheet with a wire rack and coat both with cooking spray. Set aside. In a large oven-safe skillet, melt 1 tablespoon butter over medium-low heat. Add the onions and stir to coat. Cook until onions begin to caramelize and are very soft, stirring occasionally, about 15 to 20 minutes. Stir in 1/2 teaspoon salt, 1/2 teaspoon pepper and rosemary. Add the wine; cook until it has evaporated, 2 to 3 minutes, stirring constantly.
Stir in the remaining butter; once melted, whisk in the flour until lightly browned. Slowly whisk in beef stock; bring to a simmer and cook until thickened, 2 to 3 minutes. Remove from heat; set aside.
In a large bowl, combine ground beef, bread crumbs, egg, parsley, garlic, Italian seasoning, remaining 1 teaspoon salt and remaining 1/2 teaspoon pepper. Form the mixture into 24 meatballs and place them on the prepared pan. Bake them until their internal temperature reaches 165°, 15 to 20 minutes.
Transfer meatballs to the skillet with the onion sauce; stir them in gently to combine. Top the meatballs with an even layer of shredded Gruyere. Preheat the broiler. Broil skillet 3 to 4 inches from heat until cheese is melted, 2 to 3 minutes. If desired, serve with toasted baguette slices.