This file contains 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
// 밸리데이션이나 이늄 세팅같은 부분은 AOP로 빠졌다. | |
@PostMapping("/{boardType}/form") | |
public String postCreate( | |
@Valid @ModelAttribute BoardArticle article, | |
BindingResult result, | |
@PathVariable BoardType boardType){ | |
final BoardArticle save = boardArticleService.save(article); | |
log.debug("saved Article : {}", save); | |
return article.getBoardType().getRedirectionPage(); | |
} |
This file contains 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
@Inject | |
Provider<FakeDbUserPropertyEditor> fakeDbUserPropertyEditorProvider; | |
@InitBinder | |
public void initBinder(WebDataBinder dataBinder){ | |
dataBinder.registerCustomEditor(Level.class, new LevelPropertyEditor()); | |
// 커스텀 서비스를 넣어주는 방법 | |
dataBinder.registerCustomEditor(int.class, "age", new MinMaxPropertyEditor(0, 200)); | |
// 02. 모조 방법 |
This file contains 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
@Bean | |
/*@Profile({"default", "test"})*/ | |
public MessageSource messageSource() { | |
return messageSourcePrivate(seconds); | |
} | |
private ResourceBundleMessageSource messageSourcePrivate(int seconds){ | |
ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource(); | |
messageSource.setBasenames("i18n/messages", "i18n/category" , "i18n/main", "i18n/intro", "i18n/customer"); |
This file contains 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
@PasswordsNotEqual( | |
passwordFieldName = "password", | |
passwordVerificationFieldName = "passwordVerification" | |
) |
This file contains 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.example.domain; | |
import java.util.Arrays; | |
import java.util.List; | |
import org.springframework.data.domain.Page; | |
import lombok.extern.slf4j.Slf4j; | |
@Slf4j |
This file contains 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 beanRegistryTest() throws Exception{ | |
log.info("beanRegistryTest"); | |
BeanDefinitionRegistry bdr = new DefaultListableBeanFactory(); | |
Properties p = new Properties(); | |
p.setProperty("kerry.class", "org.springframework.beans.TestBean"); | |
p.setProperty("kerry.age", "35"); | |
(new PropertiesBeanDefinitionReader(bdr)).registerBeanDefinitions(p); | |
final BeanDefinition kerry = bdr.getBeanDefinition("kerry"); | |
log.info("Kerry : {} ", kerry); |
This file contains 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 koreanCheck2() throws Exception { | |
String msg ="일이>삼사오육칠팔구십"; | |
byte[] test = msg.getBytes("UTF-8"); | |
System.out.println("총길이 :"+test.length); | |
int lastPosition = 0; | |
for(int i=0;i<20;i++){ | |
int iChar = (int) test[i]; | |
if ((iChar > 127) || (iChar < 0)) { | |
// 한글의 경우(2byte 통과처리) |
This file contains 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
@Aspect | |
public class LucyAspect4BoardArticle{ | |
private static final Logger LOGGER = LoggerFactory.getLogger(LucyAspect4BoardArticle.class); | |
//TODO 이 부분은 좀 더 세련되게 바꿔야한다. | |
//@Pointcut("execution(* com.example.service.BoardArticleService.create(..))") | |
private void profileTarget() { | |
LOGGER.debug("컨트롤러 프로필 설정"); | |
} |
This file contains 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
dependencies { | |
testCompile "org.springframework.restdocs:spring-restdocs-mockmvc:$springRestdocsVersion" | |
} | |
plugins { | |
id "org.asciidoctor.convert" version "1.5.2" | |
} | |
ext { | |
snippetsDir = file('build/generated-snippets') |