Pepper spray is useful if you seriously expect to encounter bears. My son did some serious back country travelling in Canada and took one with him. If I recall correctly you could hire one and if it were returned unused you got some money back.
Only use it on the bear if you have to do so. Some fools spray it on their clothes. And then the bear likes the smell of it and is attracted.