Я пытаюсь использовать веб-сокеты и @Async
задачи.
Итак, я создал 2 класса конфигурации:
@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig {
}
@Configuration
@EnableAsync
public class AsyncConfiguration {
}
У меня также есть служба, вводящая AsyncTaskExecutor
:
@Service
public class MyService {
@Autowired
private AsyncTaskExecutor asyncTaskExecutor;
}
После этого мое приложение не загружается, и выдается сообщение об ошибке:
***************************
APPLICATION FAILED TO START
***************************
Description:
Field asyncTaskExecutor in mypackage.MyService required a bean of type 'org.springframework.core.task.AsyncTaskExecutor' that could not be found.
The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)
The following candidates were found but could not be injected:
- Bean method 'applicationTaskExecutor' in 'TaskExecutionAutoConfiguration' not loaded because @ConditionalOnMissingBean (types: java.util.concurrent.Executor; SearchStrategy: all) found beans of type 'java.util.concurrent.Executor' clientInboundChannelExecutor, clientOutboundChannelExecutor, brokerChannelExecutor
- Bean method 'taskScheduler' in 'TaskSchedulingAutoConfiguration' not loaded because @ConditionalOnBean (names: org.springframework.context.annotation.internalScheduledAnnotationProcessor; SearchStrategy: all) did not find any beans named org.springframework.context.annotation.internalScheduledAnnotationProcessor
Action:
Consider revisiting the entries above or defining a bean of type 'org.springframework.core.task.AsyncTaskExecutor' in your configuration.
Как я могу решить эту проблему?