We do reveal much of ourselves in many stories, but certainly not all, and "confession" is certainly the wrong word for most of what I write. It simply isn't at all accurate for me. I have nothing to confess, and when I put my personal beliefs in fiction, it's intentional, and no more of a confession than the way I live my life, talk to my friends, vote, or anything else.
And in a fair number of stories I write, no character expresses anything I believe at all. Neither does the story. My job as a writer is to express what the characters believe, not what I do. If I use a character who happens to believe the same way I do, fine. I may be that character, and that character may be me, but there's still no confession.
And as I said, quite often no character has anything at all to do with me, and the story may tell a tale wherein nothing is as I believe, think, or feel.
At the same time, I don't think there's anything at all wrong with working your own beliefs into your fiction, as long as you don't preach, don't turn a perfectly good story into a manifesto of your personal beliefs and opinions. Do this, and it stops being fiction, stops being a story.
Violence may be a good example. I've experienced some serious violence first hand, and while I believe violence should always be the last resort, experience has taught me that, quite often, it's the only workable resort, and those who say "violence never solves anything" are so woefully ignorant that nothing they believe about anything can be trusted.
In real life, violence often solves everything, is the only thing that stands a chance of working, and when violence doesn't solve a some problems, it's most likely because you didn't use enough violence. I know you can't talk the violent, the murderous, the psychopaths, the dictators, the greedy, or anyone else prone to violence from using violence against you unless you are willing and able to use even more violence in return.
Sometimes I intentionally use this in fiction, but just as often I use main characters who believe and practice the exact opposite. I've always believe a writer's job is, as someone once said, to hold up a mirror that society can look in and see its true reflection. If readers look into that mirror and see the writer's reflection each time, why would anyone want to read it?