My book has been reviewed as having morals in them, and while I never set out to "teach" kids anything, I know as I was writing I couldn't help but have a few interesting lessons in there. As others have said, show don't tell. You say the morals in Charlie and the Chocolate Factory are obvious, they are. But they are also part of the plot. His is a very typical structure of a horror story really. We know from the beginning each kid is going to get theirs, one by one they are going to be picked off. So it never feels like the morals are out of place in the story, they are one and the same. In fact the entire story is one big moral, Wonka wants to find a kid to give his factory to and must leave it to the most worthy.
But again, I'm not sure it is wise thinking things like, "I want to hit them over the head with a moral". Because if that's the main focus of your story, it will just seem preachy. Say something to yourself more like: "I want to tell an awesome story, that has a really moral backbone." Or something.
And again, most importantly, show don't tell.