

Spring SseEmitter throws java.lang.IllegalArgumentException: No suitable converter class error when sending DTO object
When php editor Baicao uses Spring SseEmitter to send DTO objects, you may encounter java.lang.IllegalArgumentException: No suitable converter class error. This error usually occurs when the converter is not configured correctly, resulting in the inability to convert the DTO object into the correct data format. The way to solve this problem is to check whether the converter class is correctly configured in the configuration file and ensure that the converter class can correctly convert the DTO object into the corresponding data format.
Question content
In our spring-boot application we have the following simple ssesstatusdto
dto:
@builder @allargsconstructor @noargsconstructor public class ssestatusdto { private string currentphase; private int percentage; private string result; }
For some reason I can't understand, spring cannot convert this dto to json when trying to send the information back to the client:
emitter.send(SseEmitter.event() .data(SseStatusDto.builder() .currentPhase("DONE") .percentage(100) .result("temp-result") .build()), MediaType.APPLICATION_JSON);
I get java.lang.illegalargumentexception: No suitable converter for class <class>
What did I miss?
Solution
Try adding getters and setters for the sestatusdto
model:
@Builder @AllArgsConstructor @NoArgsConstructo @Getter @Setter public class SseStatusDto { private String currentPhase; private int percentage; private String result; }
This should solve your problem.
The above is the detailed content of Spring SseEmitter throws java.lang.IllegalArgumentException: No suitable converter class error when sending DTO object. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











The ranking of virtual currencies’ “oldest” is as follows: 1. Bitcoin (BTC), issued on January 3, 2009, is the first decentralized digital currency. 2. Litecoin (LTC), released on October 7, 2011, is known as the "lightweight version of Bitcoin". 3. Ripple (XRP), issued in 2011, is designed for cross-border payments. 4. Dogecoin (DOGE), issued on December 6, 2013, is a "meme coin" based on the Litecoin code. 5. Ethereum (ETH), released on July 30, 2015, is the first platform to support smart contracts. 6. Tether (USDT), issued in 2014, is the first stablecoin to be anchored to the US dollar 1:1. 7. ADA,

The top ten digital currency exchanges are: 1. Binance, 2. OKX, 3. gate.io, 4. Coinbase, 5. Kraken, 6. Bitfinex, 7. Huobi, 8. KuCoin, 9. Bitstamp, 10. Gemini, these platforms are highly regarded for their high liquidity, extensive trading pairs, relatively low transaction fees, multi-level security measures, and a friendly user interface.

Created by Ripple, Ripple is used for cross-border payments, which are fast and low-cost and suitable for small transaction payments. After registering a wallet and exchange, purchase and storage can be made.

OKX provides a convenient trading experience, and the app can be downloaded on the App Store and Google Play. The top three exchanges are Binance, OKX and Gate.io.

Visit Binance official website and check HTTPS and green lock logos to avoid phishing websites, and official applications can also be accessed safely.

The core advantage of gate.io (global version) is that the interface is minimalist, supports Chinese, and the fiat currency trading process is intuitive; Binance (simplified version) has the highest global trading volume, and the simple version model only retains spot trading; OKX (Hong Kong version) has the simple version of the interface is simple, supports Cantonese/Mandarin, and has a low threshold for derivative trading; Huobi Global Station (Hong Kong version) has the core advantage of being an old exchange, launches a meta-universe trading terminal; KuCoin (Chinese Community Edition) has the core advantage of supporting 800 currencies, and the interface adopts WeChat interaction; Kraken (Hong Kong version) has the core advantage of being an old American exchange, holding a Hong Kong SVF license, and the interface is simple; HashKey Exchange (Hong Kong licensed) has the core advantage of being a well-known licensed exchange in Hong Kong, supporting France

Common stablecoins are: 1. Tether, issued by Tether, pegged to the US dollar, widely used but transparency has been questioned; 2. US dollar, issued by Circle and Coinbase, with high transparency and favored by institutions; 3. DAI, issued by MakerDAO, decentralized, and popular in the DeFi field; 4. Binance Dollar (BUSD), cooperated by Binance and Paxos, and performed excellent in transactions and payments; 5. TrustTo

Ranking of the top ten currency trading platforms: 1. Binance, 2. OKX, 3. Gate.io, 4. Coinbase, 5. Kraken, 6. Huobi, 7. KuCoin, 8. Bitfinex, 9. Bittrex, 10. Poloniex, these exchanges provide registration, verification, deposit, withdrawal and trading functions, which are suitable for traders of different levels.