File tree Expand file tree Collapse file tree 2 files changed +35
-28
lines changed
src/main/java/com/olegshan/notifier Expand file tree Collapse file tree 2 files changed +35
-28
lines changed Original file line number Diff line number Diff line change 1
1
package com .olegshan .notifier ;
2
2
3
- import org .slf4j .Logger ;
4
- import org .slf4j .LoggerFactory ;
5
- import org .springframework .beans .factory .annotation .Autowired ;
6
- import org .springframework .mail .MailSender ;
7
- import org .springframework .mail .SimpleMailMessage ;
8
- import org .springframework .stereotype .Service ;
3
+ public interface Notifier {
9
4
10
- @ Service
11
- public class Notifier {
12
-
13
- private static final Logger LOGGER = LoggerFactory .getLogger (Notifier .class );
14
-
15
- private MailSender mailSender ;
16
-
17
- @ Autowired
18
- public Notifier (MailSender mailSender ) {
19
- this .mailSender = mailSender ;
20
- }
21
-
22
- public void notifyAdmin (String issue ) {
23
-
24
- SimpleMailMessage message = new SimpleMailMessage ();
25
- message .setTo ("***" );
26
- message .setSubject ("jParser issue" );
27
- message .setText (issue + "\n \n http://www.jparser.info" );
28
-
29
- mailSender .send (message );
30
- LOGGER .info ("Admin was notified about following issue: " + issue + "\n " );
31
- }
5
+ void notifyAdmin (String issue );
32
6
}
Original file line number Diff line number Diff line change
1
+ package com .olegshan .notifier .impl ;
2
+
3
+ import com .olegshan .notifier .Notifier ;
4
+ import org .slf4j .Logger ;
5
+ import org .slf4j .LoggerFactory ;
6
+ import org .springframework .beans .factory .annotation .Autowired ;
7
+ import org .springframework .mail .MailSender ;
8
+ import org .springframework .mail .SimpleMailMessage ;
9
+ import org .springframework .stereotype .Service ;
10
+
11
+ @ Service
12
+ public class NotifierImpl implements Notifier {
13
+
14
+ private static final Logger LOGGER = LoggerFactory .getLogger (NotifierImpl .class );
15
+
16
+ private MailSender mailSender ;
17
+
18
+ @ Autowired
19
+ public NotifierImpl (MailSender mailSender ) {
20
+ this .mailSender = mailSender ;
21
+ }
22
+
23
+ public void notifyAdmin (String issue ) {
24
+
25
+ SimpleMailMessage message = new SimpleMailMessage ();
26
+ message .setTo ("olegshan@gmail.com" );
27
+ message .setSubject ("jParser issue" );
28
+ message .setText (issue + "\n \n http://www.jparser.info" );
29
+
30
+ mailSender .send (message );
31
+ LOGGER .info ("Admin was notified about following issue: " + issue + "\n " );
32
+ }
33
+ }
You can’t perform that action at this time.
0 commit comments