ThreadPoolTaskExecutor - Configuration way.

Helo, what is the best way to configure ThreadPoolTaskExecutor and why? 1 - @Bean(name = "thisIsBeanName") public ThreadPoolTaskExecutor taskExecutor(ThreadProperties threadProperties) { ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor(); properties.. 2 - private final ThreadProperties threadProperties; @Bean(name = "thisIsBeanName") public ThreadPoolTaskExecutor threadPoolTaskExecutor() { ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor(); properties...
12 Replies
JavaBot
JavaBot2w ago
This post has been reserved for your question.
Hey @F4F! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
ayylmao123xdd
ayylmao123xdd2w ago
up to you tbh both work
lars
lars2w ago
How are you getting the threadProperties in your case?
F4F
F4FOP2w ago
Import files
lars
lars2w ago
which file?
F4F
F4FOP2w ago
xlsx,csv
JavaBot
JavaBot2w ago
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
ayylmao123xdd
ayylmao123xdd2w ago
forgot to add to this if you are using the properties for just 1 method in the class then the first option might be better really less code and im not sure if u need to specify the bean name if you wanted to use async you could just say
@Async("taskExecutor")
@Async("taskExecutor")
F4F
F4FOP2w ago
@ayylmao123xdd okay, thanks, any other ideas why first option is better? this option with @Async work very well
JavaBot
JavaBot2w ago
If you are finished with your post, please close it. If you are not, please ignore this message. Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
ayylmao123xdd
ayylmao123xdd2w ago
its just code readability and getting rid of declaring the field idk ask gpt to make it sound better but in short its that also not sure if thread properties is the best name for the properties class lets ask his skibidiness daniel his sudoness has said best name would be task executor configuration but if its just properties you could do task executor properties
JavaBot
JavaBot2w ago
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.

Did you find this page helpful?