SEOUL, SOUTH KOREA — Xi Jinping’s first visit to the Korean Peninsula as China’s president is to Seoul, not Pyongyang, meaning that North Korea’s best friend has snubbed it for its most bitter rival. A flurry of recent rocket and missile tests, the latest on Wednesday, has made the North’s displeasure crystal clear.

Xi’s choice to meet Thursday with South Korean President Park Geun-hye over North Korean leader Kim Jong Un upends past practice — ever since Beijing and Seoul forged diplomatic ties in 1992 — to make Pyongyang first. It highlights Beijing’s interest in nurturing booming economic ties with Seoul, while sending Pyongyang a message about its destabilizing pursuit of nuclear weapons.

For Washington and the region, it also underlines China’s growing influence on the southern side of the Korean Demilitarized Zone. Beijing, entangled in hostile territorial disputes across Asia, may see an opportunity to boost its influence with the rare neighbor that feels generally positive about China.

“In some ways the budding closeness between Xi and Park echoes much older patterns in East Asia, when China exercised a relatively benign hegemony over many of its neighbors,” said John Delury, an expert on China and Korea at Seoul’s Yonsei University.

In the week before Xi’s visit, North Korea fired seven short-range projectiles, including two launched Wednesday into waters off its east coast. Analysts said they are a message of anger directed at Xi’s choice of Seoul over Pyongyang.

The two-day summit will be Park’s fifth meeting with Xi since she took office early last year.

Chinese Foreign Ministry spokesman Qin Gang urged reporters not to “over-read” Xi’s decision to visit South Korea before the North. But many in China see the visit as not only a remarkable departure from the past, but also a sign of a budding friendship between the leaders. Much has been made of Park’s visit to Beijing last year and Xi’s decision to send Park birthday wishes earlier this year.

Money has long been the focus of the relationship between China, the world’s second-largest economy, and South Korea, the fourth-biggest economy in Asia.

They are in talks on a bilateral free trade agreement. China is South Korea’s largest trading partner, and Seoul says two-way trade topped $220 billion last year. That’s larger than the combined value of South Korea’s trade with the United States and Japan.

“In economics, the relationship is as good as it gets,” the Korea Times said in an editorial this week.

There’s also a shared distaste for Japan’s more assertive military ambitions, and for what Beijing and Seoul see as an attempt by Tokyo to obscure its brutal history in both countries in the last century.

Managing security matters, and more specifically North Korea’s pursuit of nuclear bombs and the long-range missiles to carry them, has always been trickier.

China is seen as having unusual leverage with hard-to-read North Korea and is often pressed to do more to force change. They fought together in the 1950-53 Korean War against the United States, South Korea and their allies. More recently, North Korea has repeatedly looked to China for diplomatic cover when the United Nations has taken up North Korean nuclear and missile tests and its much-criticized human rights record.

Analysts don’t think Xi will abandon North Korea entirely as long as Seoul remains loyal to an alliance with Washington that has shielded the South from North Korean aggression and allowed it to build its impressive economy. China also worries that too much pressure on Pyongyang could cause a North Korean collapse that would push swarms of refugees over the countries’ shared border.

Bitterness still lingers in Seoul over Chinese reticence to criticize what a Seoul-led international investigation said was a North Korean torpedo sneak attack on a South Korean warship that killed 46 in 2010.

Still, the accretion of worries about North Korea has helped draw Seoul and Beijing together. Officials in Seoul now expect China to take strong action over future provocations, especially if Pyongyang conducts what would be its fourth nuclear test as it moves toward building an arsenal of nuclear-tipped missiles that could reach the United States.

For its part, South Korea wants relief from the perpetual North Korean threat. Scott Snyder, an Asia specialist at the Council on Foreign Relations, wrote this week that there’s also a desire for “Beijing’s acquiescence to Seoul’s leading role in shaping the parameters for Korea’s reunification.”

China wants stability and a unified stance against Japan. It also has pushed for a resumption of the six-nation North Korean nuclear disarmament talks that it hosted until their last session in late 2008.

Xi’s visit tests close U.S. ties with South Korea and Japan that Beijing believes have been used to check its rise, said Koh Yu-hwan, a professor of North Korea studies at Seoul’s Dongguk University. It also tells Pyongyang that it could lose Chinese support if it sticks to its nuclear ambitions.

“They will not feel good about this,” Koh said of North Korea’s reaction to Xi choosing Seoul over Pyongyang.

AP writers Jung-yoon Choi in Seoul and Didi Tang in Beijing contributed to this story.