Skip to content

Commit 7a6e56b

Browse files
Profile(test) and @Profile(prod) added
Signed-off-by: vimal-java-dev <vimal929@gmail.com>
1 parent 7a0aa2e commit 7a6e56b

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

src/main/java/com/vimaltech/contactapi/service/impl/NoOpEmailService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
import com.vimaltech.contactapi.dto.EmailRequest;
44
import com.vimaltech.contactapi.service.EmailService;
55
import lombok.extern.slf4j.Slf4j;
6-
import org.springframework.context.annotation.Primary;
6+
import org.springframework.context.annotation.Profile;
77
import org.springframework.stereotype.Service;
88

99
@Service
10-
@Primary
10+
@Profile("test")
1111
@Slf4j
1212
public class NoOpEmailService implements EmailService {
1313

src/main/java/com/vimaltech/contactapi/service/impl/SmtpEmailService.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55
import lombok.extern.slf4j.Slf4j;
66
import org.springframework.beans.factory.annotation.Value;
77
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
8+
import org.springframework.context.annotation.Profile;
89
import org.springframework.mail.SimpleMailMessage;
910
import org.springframework.mail.javamail.JavaMailSender;
1011
import org.springframework.scheduling.annotation.Async;
1112
import org.springframework.stereotype.Service;
1213

1314
@Service
15+
@Profile("prod")
1416
@Slf4j
1517
@ConditionalOnProperty(name = "spring.mail.host")
1618
public class SmtpEmailService implements EmailService {

0 commit comments

Comments
 (0)