The feeling of boredom may be a signal to change what we are doing, to seek something more stimulating or pleasurable.
Many signals that the brain gives us are helpful guides, which lead us to make better decisions.
Other times, the signals the brain gives us are misleading.
In the case of boredom, the brain may be conditioned to expect a lack of stimulation or pleasure in a given activity. And it may be conditioned to expect stimulation or pleasure by leaving this activity. If this behavioural pathway is followed, it may further lead to a conditioning effect, in which the initial activity feels even more boring the next time round. It is like the forest path again, and each time you go down the path, it becomes more established.
I believe that in many cases the brain causes us to leave experiences prematurely. There might be much more pleasure, stimulation, and meaning in activities that are felt to be boring, but the brain is too habitually eager to get us out quickly, to the alternate activity.
As an exercise, I encourage practicing ways to discover interest, stimulation, meaning, and pleasure, in activities that you have pronounced to be boring (e.g. working through a textbook for school; getting through a work shift; commuting; conversing with someone who isn't your favourite person, etc.). It may require looking at the experience in a different way, with an eye to find significance, meaning, and interest, rather than focusing on the aspects that you find tiresome.
One very specific way to discover this change of perception is to take a class in drawing, painting, or photography -- often part of the experience is of learning to see things in a different way, to become absorbed with interest in something you thought was mundane. Another technique is to take courses in meditation, in which one can learn to be more at peace with the present moment, even while sitting quietly with almost no external stimuli.
In my work with students, I believe this is an extremely important issue. Many students have enrolled in a course of study that may last at least four years, or may lead to a lifetime career. Yet they are bored with what they are doing. I strongly encourage choosing courses (or other life decisions) that have a hope to be interesting, and coming to the work with an attitude of finding significance, meaning, and interest, rather than expecting or continuing an experience of boredom. Boredom leads to disengagement, a fractured relationship with what you are doing, and can be the beginning of lifelong unhappiness with the present moment.
While you may need to make external changes, it is important to make a strong effort to direct internal changes too.