From 93691a5f3f21d500029dfe97d1c3ca9e29a4451e Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 21 Aug 2017 12:01:42 +0300 Subject: www: cleanup unused injections --- juick-www/src/main/java/com/juick/www/WebApp.java | 2 +- .../java/com/juick/www/controllers/FacebookLogin.java | 4 ++-- .../src/main/java/com/juick/www/controllers/Help.java | 3 --- .../src/main/java/com/juick/www/controllers/Home.java | 8 +++----- .../src/main/java/com/juick/www/controllers/Login.java | 5 ----- .../java/com/juick/www/controllers/NewMessage.java | 15 ++++++--------- .../src/main/java/com/juick/www/controllers/PM.java | 15 ++++++--------- .../main/java/com/juick/www/controllers/Settings.java | 16 +++++++--------- .../main/java/com/juick/www/controllers/SignUp.java | 12 +++--------- .../src/main/java/com/juick/www/controllers/Tags.java | 6 +++--- .../java/com/juick/www/controllers/TwitterAuth.java | 2 +- .../src/main/java/com/juick/www/controllers/User.java | 11 ++++------- .../java/com/juick/www/controllers/UserThread.java | 18 +++++++----------- .../java/com/juick/www/controllers/VKontakteLogin.java | 4 ++-- .../main/java/com/juick/www/controllers/XMPPPost.java | 5 +---- 15 files changed, 46 insertions(+), 80 deletions(-) (limited to 'juick-www/src/main/java/com/juick/www') diff --git a/juick-www/src/main/java/com/juick/www/WebApp.java b/juick-www/src/main/java/com/juick/www/WebApp.java index a22f0cef..a0819ad6 100644 --- a/juick-www/src/main/java/com/juick/www/WebApp.java +++ b/juick-www/src/main/java/com/juick/www/WebApp.java @@ -47,7 +47,7 @@ public class WebApp implements DisposableBean { private ExternalComponent xmpp; @Inject - TagService tagService; + private TagService tagService; @Value("${img_path:/var/www/juick.com/i/}") private String imgDir; diff --git a/juick-www/src/main/java/com/juick/www/controllers/FacebookLogin.java b/juick-www/src/main/java/com/juick/www/controllers/FacebookLogin.java index 0233899f..2d32d0a5 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/FacebookLogin.java +++ b/juick-www/src/main/java/com/juick/www/controllers/FacebookLogin.java @@ -66,9 +66,9 @@ public class FacebookLogin { private ServiceBuilder serviceBuilder; @Inject - CrosspostService crosspostService; + private CrosspostService crosspostService; @Inject - UserService userService; + private UserService userService; @PostConstruct public void init() { diff --git a/juick-www/src/main/java/com/juick/www/controllers/Help.java b/juick-www/src/main/java/com/juick/www/controllers/Help.java index c5f0aeea..c11a2865 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/Help.java +++ b/juick-www/src/main/java/com/juick/www/controllers/Help.java @@ -21,7 +21,6 @@ import com.juick.server.util.HttpNotFoundException; import com.juick.server.util.UserUtils; import com.juick.service.MessagesService; import com.juick.www.HelpService; -import com.juick.www.WebApp; import org.commonmark.parser.Parser; import org.commonmark.renderer.html.HtmlRenderer; import org.springframework.stereotype.Controller; @@ -45,8 +44,6 @@ public class Help { @Inject private MessagesService messagesService; @Inject - private WebApp webApp; - @Inject private Parser cmParser; @Inject private HtmlRenderer helpRenderer; diff --git a/juick-www/src/main/java/com/juick/www/controllers/Home.java b/juick-www/src/main/java/com/juick/www/controllers/Home.java index bda3d60f..f46187ed 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/Home.java +++ b/juick-www/src/main/java/com/juick/www/controllers/Home.java @@ -51,15 +51,13 @@ import java.util.stream.Collectors; @Controller public class Home { @Inject - UserService userService; + private UserService userService; @Inject - MessagesService messagesService; + private MessagesService messagesService; @Inject - TagService tagService; + private TagService tagService; @Inject private Sape sape; - @Inject - WebApp webApp; @GetMapping("/{anything}/**") protected String parseAnyThing(@PathVariable String anything, diff --git a/juick-www/src/main/java/com/juick/www/controllers/Login.java b/juick-www/src/main/java/com/juick/www/controllers/Login.java index ed82f67d..ff58e8d0 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/Login.java +++ b/juick-www/src/main/java/com/juick/www/controllers/Login.java @@ -16,20 +16,15 @@ */ package com.juick.www.controllers; -import com.juick.service.UserService; import com.juick.server.util.UserUtils; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; -import javax.inject.Inject; - /** * @author Ugnich Anton */ @Controller public class Login { - @Inject - private UserService userService; @GetMapping("/login") public String getloginForm() { diff --git a/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java b/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java index 46a5660d..9144bc73 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java +++ b/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java @@ -25,7 +25,6 @@ import org.apache.commons.lang3.StringUtils; import org.apache.commons.text.StringEscapeUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.core.env.Environment; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.GetMapping; @@ -53,19 +52,17 @@ import java.util.stream.Collectors; public class NewMessage { @Inject - Environment env; + private TagService tagService; @Inject - TagService tagService; + private MessagesService messagesService; @Inject - MessagesService messagesService; + private UserService userService; @Inject - UserService userService; + private SubscriptionService subscriptionService; @Inject - SubscriptionService subscriptionService; + private CrosspostService crosspostService; @Inject - CrosspostService crosspostService; - @Inject - WebApp webApp; + private WebApp webApp; private static final Logger logger = LoggerFactory.getLogger(NewMessage.class); diff --git a/juick-www/src/main/java/com/juick/www/controllers/PM.java b/juick-www/src/main/java/com/juick/www/controllers/PM.java index b52ad4fe..fda3501b 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/PM.java +++ b/juick-www/src/main/java/com/juick/www/controllers/PM.java @@ -18,12 +18,11 @@ package com.juick.www.controllers; import com.juick.server.util.HttpBadRequestException; import com.juick.server.util.HttpForbiddenException; -import com.juick.service.MessagesService; +import com.juick.server.util.UserUtils; +import com.juick.server.util.WebUtils; import com.juick.service.PMQueriesService; import com.juick.service.TagService; import com.juick.service.UserService; -import com.juick.server.util.UserUtils; -import com.juick.server.util.WebUtils; import com.juick.www.WebApp; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; @@ -49,15 +48,13 @@ public class PM { private static final Logger logger = LoggerFactory.getLogger(PM.class); @Inject - PMQueriesService pmQueriesService; - @Inject - TagService tagService; + private PMQueriesService pmQueriesService; @Inject - UserService userService; + private TagService tagService; @Inject - MessagesService messagesService; + private UserService userService; @Inject - WebApp webApp; + private WebApp webApp; @GetMapping("/pm/inbox") protected String doGetInbox(ModelMap model) { diff --git a/juick-www/src/main/java/com/juick/www/controllers/Settings.java b/juick-www/src/main/java/com/juick/www/controllers/Settings.java index 703b2bec..b49c0f1c 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/Settings.java +++ b/juick-www/src/main/java/com/juick/www/controllers/Settings.java @@ -61,21 +61,19 @@ public class Settings { private static final Logger logger = LoggerFactory.getLogger(Settings.class); @Inject - WebApp webApp; + private WebApp webApp; @Inject - TagService tagService; + private TagService tagService; @Inject - UserService userService; + private UserService userService; @Inject - CrosspostService crosspostService; + private CrosspostService crosspostService; @Inject - SubscriptionService subscriptionService; + private SubscriptionService subscriptionService; @Inject - EmailService emailService; + private EmailService emailService; @Inject - TelegramService telegramService; - @Inject - MessagesService messagesService; + private TelegramService telegramService; @GetMapping("/settings") protected String doGet(HttpServletRequest request, HttpServletResponse response, ModelMap model) throws IOException { diff --git a/juick-www/src/main/java/com/juick/www/controllers/SignUp.java b/juick-www/src/main/java/com/juick/www/controllers/SignUp.java index 2e394ae5..c8c64ef5 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/SignUp.java +++ b/juick-www/src/main/java/com/juick/www/controllers/SignUp.java @@ -18,11 +18,9 @@ package com.juick.www.controllers; import com.juick.server.util.HttpBadRequestException; import com.juick.server.util.HttpForbiddenException; +import com.juick.server.util.UserUtils; import com.juick.service.CrosspostService; -import com.juick.service.MessagesService; import com.juick.service.UserService; -import com.juick.server.util.UserUtils; -import com.juick.www.WebApp; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.GetMapping; @@ -41,13 +39,9 @@ import javax.servlet.http.HttpServletResponse; public class SignUp { @Inject - WebApp webApp; - @Inject - UserService userService; - @Inject - CrosspostService crosspostService; + private UserService userService; @Inject - MessagesService messagesService; + private CrosspostService crosspostService; @GetMapping("/signup") diff --git a/juick-www/src/main/java/com/juick/www/controllers/Tags.java b/juick-www/src/main/java/com/juick/www/controllers/Tags.java index 4c00ad6a..6a22216f 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/Tags.java +++ b/juick-www/src/main/java/com/juick/www/controllers/Tags.java @@ -43,11 +43,11 @@ import java.util.stream.Collectors; @Controller public class Tags { @Inject - MessagesService messagesService; + private MessagesService messagesService; @Inject - TagService tagService; + private TagService tagService; @Inject - UserService userService; + private UserService userService; @GetMapping("/tag/{tagName}") protected String tagAction(HttpServletRequest request, diff --git a/juick-www/src/main/java/com/juick/www/controllers/TwitterAuth.java b/juick-www/src/main/java/com/juick/www/controllers/TwitterAuth.java index fb63069c..fddcd355 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/TwitterAuth.java +++ b/juick-www/src/main/java/com/juick/www/controllers/TwitterAuth.java @@ -56,7 +56,7 @@ public class TwitterAuth { private ObjectMapper jsonMapper; @Inject - UserService userService; + private UserService userService; private ServiceBuilder serviceBuilder; diff --git a/juick-www/src/main/java/com/juick/www/controllers/User.java b/juick-www/src/main/java/com/juick/www/controllers/User.java index 26eb7cb1..8b7f2e09 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/User.java +++ b/juick-www/src/main/java/com/juick/www/controllers/User.java @@ -18,12 +18,11 @@ package com.juick.www.controllers; import com.juick.server.util.HttpForbiddenException; import com.juick.server.util.HttpNotFoundException; +import com.juick.server.util.UserUtils; import com.juick.service.MessagesService; import com.juick.service.TagService; import com.juick.service.UserService; -import com.juick.server.util.UserUtils; import com.juick.www.Utils; -import com.juick.www.WebApp; import org.apache.commons.codec.CharEncoding; import org.apache.commons.lang3.StringUtils; import org.apache.commons.text.StringEscapeUtils; @@ -50,13 +49,11 @@ import java.util.stream.Collectors; @Controller public class User { @Inject - WebApp webApp; - @Inject - UserService userService; + private UserService userService; @Inject - TagService tagService; + private TagService tagService; @Inject - MessagesService messagesService; + private MessagesService messagesService; @Inject private Sape sape; diff --git a/juick-www/src/main/java/com/juick/www/controllers/UserThread.java b/juick-www/src/main/java/com/juick/www/controllers/UserThread.java index 51d715cf..f15861f4 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/UserThread.java +++ b/juick-www/src/main/java/com/juick/www/controllers/UserThread.java @@ -16,24 +16,22 @@ */ package com.juick.www.controllers; -import com.juick.Message; import com.juick.server.util.HttpForbiddenException; import com.juick.server.util.HttpNotFoundException; +import com.juick.server.util.UserUtils; import com.juick.service.MessagesService; -import com.juick.service.TagService; import com.juick.service.UserService; -import com.juick.util.MessageUtils; -import com.juick.server.util.UserUtils; -import com.juick.www.WebApp; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestParam; import javax.inject.Inject; import java.io.IOException; -import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; @@ -45,11 +43,9 @@ import java.util.List; public class UserThread { @Inject - WebApp webApp; - @Inject - MessagesService messagesService; + private MessagesService messagesService; @Inject - UserService userService; + private UserService userService; @GetMapping("/{uname}/{mid}") protected String threadAction(ModelMap model, diff --git a/juick-www/src/main/java/com/juick/www/controllers/VKontakteLogin.java b/juick-www/src/main/java/com/juick/www/controllers/VKontakteLogin.java index 07bd7455..382c3194 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/VKontakteLogin.java +++ b/juick-www/src/main/java/com/juick/www/controllers/VKontakteLogin.java @@ -60,9 +60,9 @@ public class VKontakteLogin { private static final String VK_REDIRECT = "http://juick.com/_vklogin"; @Inject - CrosspostService crosspostService; + private CrosspostService crosspostService; @Inject - UserService userService; + private UserService userService; private ServiceBuilder serviceBuilder; diff --git a/juick-www/src/main/java/com/juick/www/controllers/XMPPPost.java b/juick-www/src/main/java/com/juick/www/controllers/XMPPPost.java index 99957ede..51b9d964 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/XMPPPost.java +++ b/juick-www/src/main/java/com/juick/www/controllers/XMPPPost.java @@ -20,7 +20,6 @@ package com.juick.www.controllers; import com.juick.server.util.HttpBadRequestException; import com.juick.server.util.HttpForbiddenException; import com.juick.server.util.HttpUtils; -import com.juick.service.TagService; import com.juick.server.util.UserUtils; import com.juick.www.WebApp; import org.apache.commons.lang3.StringUtils; @@ -48,9 +47,7 @@ public class XMPPPost { private final static Logger logger = LoggerFactory.getLogger(XMPPPost.class); @Inject - WebApp webApp; - @Inject - TagService tagService; + private WebApp webApp; @PostMapping("/post2") public String doPostMessage(@RequestParam(name = "body") String bodyParam, -- cgit v1.2.3