I would caution putting thorny plants too close to a public sidewalk. If they aren't kept pruned back, you might end up sued. You will be the one having to prune the thorny plant, so you'll be the one suffering the most. Generally speaking, any type of hedge will discourage people. If you're trying to discourage animals, again, might work, except, won't they come through the same entrance you use? Most likely your driveway?
Will the plant be happy there? Yes, indeedy. Not sure they'd like being pruned to a 2 foot height.
And if you are trying to discourage folks, why are you tempting them with food?