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
⌛
This post has been reserved for your question.
Hey @F4F! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose 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.
up to you tbh both work
How are you getting the threadProperties in your case?
Import files
which file?
xlsx,csv
💤
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.
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
@ayylmao123xdd okay, thanks, any other ideas why first option is better? this option with @Async work very well
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.
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
💤
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.