It does sound mean, but is a lot better than the alternative. If the bear returns, wildlife officials will have to capture and euthanize it. That might be an unfair punishment for just seeking a little bit of German takeout, but bears going through trash and concluding that humans are a great source of food is dangerous for everyone involved.
Fortunately, the dumpster vandal seems to be less clever than the average bear, and took off after setting a paw on the spike strip. Sorry about that, bear.