diff options
author | 2018-04-11 12:28:03 +0300 | |
---|---|---|
committer | 2018-04-11 12:28:03 +0300 | |
commit | bca490f397752c0363599f9070498bade622a322 (patch) | |
tree | 89ba9eb4e92cb256947229b26be770d37dc52c7c | |
parent | 10e624937adaf2dc6cdfad9f214552e6a2fcd9eb (diff) |
server: twitter4j cannot reuse configuration builder
-rw-r--r-- | juick-server/src/main/java/com/juick/server/TwitterManager.java | 14 |
1 files changed, 4 insertions, 10 deletions
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()); |