This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.collect.utils; | |
import lombok.AllArgsConstructor; | |
import org.springframework.stereotype.Component; | |
import org.thymeleaf.context.Context; | |
import org.thymeleaf.spring5.SpringTemplateEngine; | |
import software.amazon.awssdk.services.ses.SESAsyncClient; | |
import software.amazon.awssdk.services.ses.model.Body; | |
import software.amazon.awssdk.services.ses.model.Content; | |
import software.amazon.awssdk.services.ses.model.Destination; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
compile('org.springframework.boot:spring-boot-starter-thymeleaf') | |
// AWS SDK v2 | |
compile group: 'software.amazon.awssdk', name: 'ses', version: "${awsSdkSesVersion}" | |
compile group: 'net.minidev', name: 'json-smart', version: "${minidevVersion}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@AllArgsConstructor | |
@Service | |
public class UserService { | |
private final AmazonSimpleEmailServiceAsync amazonSimpleEmailServiceAsync; | |
public void sendMail() { | |
final String FROM = "[email protected]"; | |
final String TO = "[email protected]"; | |
final String SUBJECT = "Amazon SES test (AWS SDK for Java)"; | |
final String HTMLBODY = "<h1>Amazon SES test (AWS SDK for Java)</h1>" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
compile group: 'com.amazonaws', name: 'aws-java-sdk-ses', version: "${awsSesVersion}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void 골뱅이_있지만_유효하지않는_format_400() throws Exception { | |
UserSaveDto userSaveDto = new UserSaveDto(); | |
userSaveDto.setUsername("hjh"); | |
userSaveDto.setAddress("seoul"); | |
userSaveDto.setPassword("123456"); | |
userSaveDto.setEmail("hjh544@g"); | |
userSaveDto.setProvider(Provider.create("test")); | |
this.mockMvc.perform( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RunWith(SpringRunner.class) | |
@SpringBootTest | |
@AutoConfigureMockMvc | |
public class UserControllerTests { | |
// injection 코드들 생략... | |
@Test | |
public void 인자가_아무것도_없을때_400() throws Exception { | |
this.mockMvc.perform(post("/user/signup")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RestControllerAdvice | |
public class WebRestControllerAdvice { | |
/** | |
* 필수값이 안넘어왔을때 400 던지는 Custom Exception | |
*/ | |
@ExceptionHandler(BadRequestException.class) | |
@ResponseStatus(HttpStatus.BAD_REQUEST) | |
public SimpleMessageDto invalidParameterException(BadRequestException ex) { | |
return new SimpleMessageDto("missing required value"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@PostMapping("/signup") | |
@ResponseStatus(HttpStatus.CREATED) | |
public void signUp(@Valid @RequestBody UserSaveDto userSaveDto, BindingResult result) { | |
if (result.hasErrors()) { | |
throw new BadRequestException("missing required value"); | |
} | |
userService.saveUser(userSaveDto); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT COUNT(*) | |
FROM ( | |
SELECT * | |
FROM ben.sample_event_table | |
LIMIT 100) | |
) sub |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
default_platform: 64bit Amazon Linux 2017.03 v2.7.1 running Multi-container Docker 17.03.1-ce (Generic) |