German Chancellor Olaf Scholz speaks to the media during a press conference in Tokyo, April 28.

Photo: POOL/REUTERS

What was Olaf Scholz doing in Tokyo last week? The visit will be clanging alarm bells in Beijing as China anxiously tracks the fallout from Vladimir Putin’s invasion of Ukraine.

The newish German chancellor’s trip to Japan to discuss economic and strategic cooperation is a sign of a major change under way in Berlin. The clue is the destination Mr. Scholz skipped: Beijing. Mr. Scholz’s predecessor, Angela Merkel, visited China the way Chicagoans vote—early and often. Her first jaunt to Beijing came six months after she took office, and she visited China twice as often as Japan during her 16 years in office. That Mr. Scholz shows signs of bucking this trend is significant.

It’s more fallout from the Ukraine war. Germany’s shock at Vladimir Putin’s invasion is both sincere and wrenching. The economic element is twofold. The old maxim of Wandel durch Handel—change through trade—which was almost by default Ms. Merkel’s only foreign-policy strategy, suddenly has fallen into bad repute. Cultivating closer economic ties with Mr. Putin’s Russia didn’t dissuade the autocrat from his imperialism. And now that Wandel has failed, the closely entwined business relationships created by all that Handel are proving devilishly hard to disentangle.

In this climate, thoughts have quickly turned to China, long Germany’s other object of change through trade. Beijing has helped sharpen this negative focus, perhaps most notably with Xi Jinping’s early-February pledge of “no limits” friendship with Mr. Putin. Europeans are frustrated with Mr. Xi’s unwillingness or inability to broker a peace in Ukraine.

The autocratic invasion of Ukraine also raises worries about an autocratic invasion of Taiwan, a prospect Europe previously discounted. And Mr. Xi’s economy-killing zero-Covid policies undermine the business case for foreign investors. Thanks to foolish policy errors in Beijing, the country will miss this year’s annual economic-growth target by a wide margin.

The result is a new German skepticism of China that’s playing itself out along three dimensions.

Businesses are growing anxious. This is not precisely new, after it became clear in recent years that Mr. Xi would not continue the reform-and-market-opening path of his predecessors. But of late the drumbeat of German businesses rethinking China has grown more insistent.

A survey by the Munich-based Ifo Institute think tank conducted in February found that 45% of German manufacturers said they planned to reduce imports from China, and 55% of retailers. “Foreign companies are hitting the pause button,” Joerg Wuttke of the EU Chamber of Commerce in China said in a recent interview, regarding business nerves about potential parallels between Ukraine and Taiwan. The comment hit a particular nerve in his native Germany.

Within the political and policy class, too, a China rethink is under way. Lawmakers in the national parliament last week passed a resolution calling on Mr. Scholz to accelerate heavy-weapons deliveries to Kyiv. Somewhat surprisingly, China got a paragraph of its own, in which legislators demanded Mr. Scholz threaten to impose sanctions on Beijing if China obstructs Western sanctions on Russia or supplies Russia with weapons. The resolution was nonbinding, but Mr. Scholz said he interprets it as a mandate.

Foreign Minister Annalena Baerbock in March inaugurated a foreign-policy review. China featured prominently in her speech although not always by name: Europe must be aware that “vulnerability in the 21st century can also consist in authoritarian states investing billions of euros in European motorways, roads, power grids and ports,” she warned in a barely veiled shot at Beijing.

A special mention here goes to Ms. Merkel’s center-right Christian Democratic party, now in the opposition, which is quickly and not-so-discreetly running away from her Wandel durch Handel legacy. In a national-security outline released Monday, the CDU leadership calls for a “revision and reassessment” of Germany’s economic approach. “Germany needs a new globalization strategy that focuses more on growth opportunities in the European Union, the U.S. and Africa, and reassesses dependence on other countries,” the party elders write, and no prize for guessing which “other countries” they have in mind.

The broader public debate is accelerating. “Could Germany afford to bid the China market farewell?” the business-minded newspaper Frankfurter Allgemeine asked in March. The answer, with a few caveats, was yes. This is part of a rapidly expanding genre in which commentators, reporters and assorted others pick over various aspects of the Germany-China economic relationship, whether the auto industry or imports of raw materials or any of a variety of other questions, searching for ways Germany can improve its economic security.

Whether Germany’s new skepticism of China sticks will be a major political, economic and strategic question of the next decade. A likely outcome is not a total divorce, but rather the adoption in Berlin of a less enthusiastic, more hard-nosed attitude toward China. That will still be a far cry from what Mr. Xi probably thought he’d get when he signed his friendship pact with Mr. Putin three months ago.