You really need to have a look at the scale of Chinese investment, migration and trade with Africa.
Just as cheap Chinese goods and Chinese built infrastructure changing Africa, African raw materials and demand will be key to China's future.
The US and EU are big and rich, but they are also declining and increasingly saturated. That means margins and profits are thin, and competition fierce. It's the same story with China's domestic market as western firms have been discovering to their cost.
Africa is poor today, but it has vast population, resources and potential, much like the Asia Pacific after WWII. That similarity is unlikely to have escaped the notice of Chinese businessmen and government strategists, and there is a reason why there are millions of Chinese nationals living and working in Africa today.
Contrary to most western views about China only wanted to make a quick buck in Africa and pull out, the fact of the matter is the Chinese people and the Chinese government have long-term plans. That is why China is so keen to build roads and railways and bridges. They want to implement the same strategy they used with such success in China on Africa, and Chinese companies and businessmen are positioning themselves to best facilitate and benefit from the economic growth that will follow if everything works.
But Africa can also be a dangerous place, as recent wars and crisis have demonstrated quite graphically, and the Chinese military has always been called into action several times to help safeguard and evacuate Chinese nationals from trouble spots.
In the immediate term, the Chinese government will know full well how much money such large-scale evacuations costs the Chinese taxpayer. In such context, the cost of maintaining military bases in the region will not seem quite so high if you consider the cost savings that could have been made if it was possible to evacuate Chinese nationals to a Chinese military base, and then arrange transportation back to China from there, instead of evacuating them to nearby countries and putting them all up in 3 star hotels and/or chartering direct flights from the trouble spot to China.
In the medium to long term, it would not have escaped notice that while the Chinese government was able to successful evacuate it's citizens, vast amounts of private and state property had to be abandoned, and hugely expensive contracts may not become void and useless. In addition, there were many case of robbery and assault of Chinese nationals as they tried to escape the trouble zone by themselves.
Having military bases in the region opens up new options and possibilities, ranging from helping to add stability to prevent things from spiraling out of control in the first place to military escorts and extractions to make sure Chinese nationals can all get out, and with as much of their property as possible.
Like it or not, China is an international power, and it's fate and fortunes are increasingly intertwined, linked and dependent on other nations. Up to now, China's overseas interests were overwhelmingly in the US and Europe, who can look after their own security and where the rule of law usually provides protection for Chinese companies and nationals there. However, as Africa becomes ever more important to China, China must also have the military options to safeguard the vast numbers of it's nationals and property invested in Africa. That means military bases.