Я аннотированный класс Thread следующим образом:Spring JPA темы: IllegalArgumentException Исключение
@Transactional(propagation = Propagation.REQUIRED)
@Component
@Scope("prototype")
public class ThreadRetrieveStockInfoEuronext implements Runnable {
...
}
нить подключается в класс контроллера и вызывается через Global.poolMultiple.execute (threadRetrieveStockInfoEuronext);
public class RetrievelController {
@Autowired
private ThreadRetrieveStockInfoEuronext threadRetrieveStockInfoEuronext;
@RequestMapping(value = "/.retrieveStockInfo.htm", method = RequestMethod.POST)
public ModelAndView submitRetrieveStockInfo(@ModelAttribute("retrieveStockInfoCommand") RetrieveStockInfoCommand command, BindingResult result, HttpServletRequest request) throws Exception {
Global.poolMultiple.execute(threadRetrieveStockInfoEuronext);
return new ModelAndView(".retrieveStockInfo", "retrieveStockInfoCommand", command);
}
Глобальный класс:
@SuppressWarnings("unchecked")
@Component
public class Global {
// create ExecutorService to manage threads
public static ExecutorService poolMultiple = Executors.newFixedThreadPool(10);
public static ExecutorService poolSingle = Executors.newFixedThreadPool(1);
...
}
При запуске приложения происходит следующее исключение:
java.lang.IllegalArgumentException: Невозможно установить com.chartinvest.admin. thread.ThreadRetrieveStockInfoEuronext field
com.chartinvest.controller.RetrievelContr oller.threadRetrieveStockInfoEuronext к com.sun.proxy. $ Proxy52
Большое спасибо JB для вашего посоветуйте, Решение работает отлично! – user2023141