From bca490f397752c0363599f9070498bade622a322 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 11 Apr 2018 12:28:03 +0300 Subject: server: twitter4j cannot reuse configuration builder --- .../src/main/java/com/juick/server/TwitterManager.java | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'juick-server/src/main/java/com') diff --git a/juick-server/src/main/java/com/juick/server/TwitterManager.java b/juick-server/src/main/java/com/juick/server/TwitterManager.java index d386423b..7d4f8ccc 100644 --- a/juick-server/src/main/java/com/juick/server/TwitterManager.java +++ b/juick-server/src/main/java/com/juick/server/TwitterManager.java @@ -50,16 +50,6 @@ public class TwitterManager { @Value("${twitter_consumer_secret:secret}") private String twitter_consumer_secret; - private ConfigurationBuilder configurationBuilder; - - @PostConstruct - public void init() { - configurationBuilder = new ConfigurationBuilder() - .setDebugEnabled(true) - .setOAuthConsumerKey(twitter_consumer_key) - .setOAuthConsumerSecret(twitter_consumer_secret); - } - @Async @EventListener public void onApplicationEvent(@Nonnull MessageEvent event) { @@ -80,6 +70,10 @@ public class TwitterManager { status = status.substring(0, 254) + "…"; } status += " http://juick.com/" + jmsg.getMid(); + ConfigurationBuilder configurationBuilder = new ConfigurationBuilder() + .setDebugEnabled(true) + .setOAuthConsumerKey(twitter_consumer_key) + .setOAuthConsumerSecret(twitter_consumer_secret); TwitterFactory tf = new TwitterFactory(configurationBuilder .setOAuthAccessToken(t.getToken()) .setOAuthAccessTokenSecret(t.getSecret()).build()); -- cgit v1.2.3