What a difference a year makes.

In the months before last year's presidential election in Brazil, Jair Bolsonaro described China as predatory and thumbed his nose at the Chinese government by visiting Taiwan, Beijing's archrival.

Now, as a more pragmatic president, Bolsonaro is welcoming Chinese President Xi Jinping to an international summit that begins Wednesday in Brasilia, the capital.

Members of the Presidential Guard march down the ramp of the presidential palace surrounded by barricades ahead of the 11th edition of the BRICS Summit, in Brasilia, Brazil, Tuesday, Nov. 12, 2019. The BRICS Summit, gathering the leaders of Brazil, Russia, India, China and South Africa, will take place in Brasilia Nov. 13-14. (AP PhotoEraldo Peres)

Members of the Presidential Guard march down the ramp of the presidential palace surrounded by barricades ahead of the 11th edition of the BRICS Summit, in Brasilia, Brazil, Tuesday, Nov. 12, 2019. The BRICS Summit, gathering the leaders of Brazil, Russia, India, China and South Africa, will take place in Brasilia Nov. 13-14. (AP PhotoEraldo Peres)

The first item on the agenda for Bolsonaro, a far-right leader who has sometimes tried to hang the communist label on his political rivals in Brazil, is a bilateral meeting with Xi. It's a sign of how Bolsonaro views China as critical to his ambitions to rejuvenate Brazil's sluggish economy.

Gone is last year's fiery campaign trail rhetoric about China being a rapacious power intent on exploiting Brazilian resources.

China is, after all, Brazil's biggest trading partner.

Brazilian army soldiers prepare a security base prior the 11th edition of the BRICS Summit, at the Itamaraty Palace in Brasilia, Brazil, Tuesday, Nov. 12, 2019. The BRICS Summit gathers the group of countries formed by Brazil, Russia, India, China and South Africa, which will take place in the 13th and 14th of this month. (AP PhotoEraldo Peres)

Brazilian army soldiers prepare a security base prior the 11th edition of the BRICS Summit, at the Itamaraty Palace in Brasilia, Brazil, Tuesday, Nov. 12, 2019. The BRICS Summit gathers the group of countries formed by Brazil, Russia, India, China and South Africa, which will take place in the 13th and 14th of this month. (AP PhotoEraldo Peres)

As China expanded rapidly in the 2000s, eventually becoming the world's second largest economy, it relied on commodities from producers. Brazil, Latin America's largest economy, shipped soybeans, iron ore and crude to satisfy China's voracious appetite. Those three products account for more than 80% of Brazil's exports to China.

Xi's visit for a meeting of leaders of the BRICS emerging economies (Brazil, Russia, India, China and South Africa) is his first to Brazil since 2014.

But his relationship with Bolsonaro has already been blossoming.

Brazilian army soldiers prepare a security base prior the 11th edition of the BRICS Summit, at the Itamaraty Palace in Brasilia, Brazil, Tuesday, Nov. 12, 2019. The BRICS Summit gathers the group of countries formed by Brazil, Russia, India, China and South Africa, which will take place in the 13th and 14th of this month. (AP PhotoEraldo Peres)

Brazilian army soldiers prepare a security base prior the 11th edition of the BRICS Summit, at the Itamaraty Palace in Brasilia, Brazil, Tuesday, Nov. 12, 2019. The BRICS Summit gathers the group of countries formed by Brazil, Russia, India, China and South Africa, which will take place in the 13th and 14th of this month. (AP PhotoEraldo Peres)

Just last month, Bolsonaro traveled to Beijing for economic and other accords, including the exemption of Chinese nationals from Brazil visa requirements. Xi received him at his car and they walked side-by-side on a long, red carpet.

"Bolsonaro discovered how important China is to Brazil and that he can do business with China. And he's more or less happy with that," said Mauricio Santoro, professor of international relations at Rio de Janeiro's state university, UERJ.

Before he became president, Bolsonaro praised the U.S. and President Donald Trump. He often said China can buy from Brazil, but not buy Brazil itself — rhetoric that continued for a while after he took office Jan. 1.

The hostile remarks didn't last, though.

Brazil is dependent on foreign investment, especially from China.

Confirmed Chinese investments in Brazil between 2007 and 2018 totaled almost $60 billion, more than any other Latin American country, according to the Brazil-China Business Council, a Brazilian research center.

Investments faltered in 2018 ahead of Brazil's election, part of a broader decline stemming from investor caution.

After Bolsonaro won the presidency, he took his first trip abroad to the U.S., then in the midst of a growing trade dispute with China. But Brazil didn't get caught in the middle.

"Brazil has all the reasons to work with both countries and not pick sides," said Pepe Zhang, associate China director at the Washington-based Atlantic Council. "So far, it's doing a good job."

In August, amid Western criticism of Brazil's handling of fires raging in the Amazon, China defended Brazil. Bolsonaro described China's support as "priceless."

As Brazil-Chinese diplomacy advances, there are delicate issues to navigate.

The U.S., for example, is pressuring the Brazilian government to exclude Chinese telecommunications giant Huawei from its auction next year to provide a 5G network.

The U.S. State Department says that Huawei poses cybersecurity risks and that it will review the way it shares intelligence about Venezuela with Brazil if Huawei is allowed to provide 5G service.

The U.S. and Brazil consider Venezuelan President Nicolás Maduro to be illegitimate and want him to resign.

China, eager for repayment of the billions of dollars in oil-backed loans it extended to Venezuelan President Nicolas Maduro's socialist administration, continues to support his regime.

Bolsonaro knows he won't find common ground with Xi on Venezuela when they meet, and will likely focus on luring more Chinese investment and trade, said Santoro, the international relations professor.

Bolsonaro, a fringe lawmaker until his campaign, earned the nickname " Trump of the Tropics" for his rejection of politically correct discourse, and many of his supporters came to see him as a crusader willing to impose morality on a political system rife with corruption and a society suffering from violent crime.

But he has been more reined in on the economy. He handed the reins of economic policymaking to a University of Chicago-trained economist who is taking steps to improve business conditions, reduce trade barriers of Brazil's protected market, and carry out a vast privatization program.

Some Brazilians were concerned that Bolsonaro as president would assume a "bipolar vision of the world" and closely align with the U.S. at the expense of China relations, said José Pio Borges, president of Cebri, a Brazilian research center that studies China.

"Now, after all these reunions and initiatives, it's clear that Brazil wants to have relationships with everyone," Borges said.