Sometimes I come across books that are nothing but frame stories, and they annoy the bajeezus out of me.
While it's fine for a novel to have a message or to teach good values, they should always first focus on the storytelling and the characters who are experiencing the plot. And furthermore, if you have an important message that you want to impart to others through fiction, it will actually be much more effective if it's funneled through an authentic and enjoyable story. If you as an author find yourself more interested in inspiring people on what to believe than you are in telling the characters' story, you should just be honest and write prescriptive nonfiction.
But then there's the question of how you're supposed to use positive messages in your book without making the novel a frame story. It's actually very simple, and I'll emphasize that I'm not saying books shouldn't have messages. I'm saying they absolutely must read like stories (not lectures) and absolutely must contain people (not puppets).
But the main characters--and even some of the secondary and tertiary supporting characters--have depth and history so you know where they're coming from; they have personal struggles and idiosyncratic quirks; they are about way more than representing their race. And nobody ever stops the action to give us a nice speech on why it's so important that black people and white people get along. (And it should be noted that their races also are not at all invisible. It's not one of those "they said this one's white and this one's black, but we wouldn't have known from context otherwise" kinds of "I don't see color" books. Their racial backgrounds are part of the characters. They just aren't their defining characteristic or sole identity.)
What's interesting is how overt this message is without being a frame story. It's the characters that make it special--Stargirl is certainly quirky in a manic-pixie-dream-girl way, with her ukulele playing, weird clothes, and tendency to change her name to whatever suits her. But she's more than that, too. She's special because she pays attention to what other people feel, and reacts to it; she's special because she isn't "trying to be an individual" with her stunts so much as honestly being cut from a different cloth; she's special because when you see her weirding everyone out by cheering for the opposite team as well as her own team, you know her well enough to understand why she does it. When she goes through her self-exploration phase in the opposite way that most teens do--trying to be more conventional, for the sake of love--you don't get a tidy wrap-up at the end where everyone's learned their lessons and now we all know to be ourselves. We understand why fundamentally changing yourself for someone else is not about love, because we see the consequences as they take their toll on these characters. We don't feel like we just watched an after-school special about individuality. We feel the loss and we understand the people who lost. And that's what the book is about. You'll come away with a message, but you'll never feel like the author tricked you into following a character's story just so they could make them give lip service to their own agenda.
The key to presenting a message through fiction is always going to lie in the authenticity of your characters. Make us understand them and why everything in their lives has led them to believe what they do, and we'll believe in them enough to want to listen to you. But make their personalities secondary to the message you're piping in from a different universe, and I promise you we'll feel it.