Я устанавливаю простой бегун с пружинной загрузкой для проверки десериализации Джексона, но он не работает
com.fasterxml.jackson.databind.exc.MismatchedInputException
В простой пустой статической магистрали (String args []) {..... тот же код ....}, он работает
Не могу найти разницу
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
import com.fasterxml.jackson.databind.ObjectMapper;
@SpringBootApplication
public class RondoTestApplication {
public static void main(String[] args) {
SpringApplication.run(RondoTestApplication.class, args);
}
@Bean
public CommandLineRunner commandLineRunner() throws Exception {
System.out.println("--> STARTED");
Pojo pojo = new Pojo();
ObjectMapper mapperSimple = new ObjectMapper();
String jsonStr = mapperSimple.writeValueAsString(pojo);
System.out.println("--------"+jsonStr);
pojo = mapperSimple.readValue(jsonStr, Pojo.class);
System.out.println("--------"+pojo.getItems().size());
return null;
}
public class Pojo {
private List items = new ArrayList<>();
public List getItems() {
return items;
}
public void setItems( List items) {
this.items = items;
}
}
}
Можете ли вы помочь, пожалуйста?