kotlin-logging
에서 logger
를 선언하는 방법은 2가지로 정리할 수 있다.
import io.github.oshai.kotlinlogging.KotlinLogging
private val logger = KotlinLogging.logger {} // 로거를 클래스 밖에 두는 방법
### Querydsl | |
/src/main/generated |
import org.springframework.boot.context.properties.ConfigurationProperties; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; | |
import org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver; | |
@Configuration | |
public class ThymeleafConfig { | |
@Bean | |
public SpringResourceTemplateResolver thymeleafTemplateResolver( |
package com.example.bootdemo; | |
import io.swagger.models.parameters.AbstractSerializableParameter; | |
import io.swagger.models.properties.BaseIntegerProperty; | |
import org.junit.jupiter.api.AfterEach; | |
import org.junit.jupiter.api.BeforeEach; | |
import org.junit.jupiter.api.Test; | |
import java.io.ByteArrayOutputStream; | |
import java.io.PrintStream; |
package com.your.project.config; | |
import com.zaxxer.hikari.HikariDataSource; | |
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties; | |
import org.springframework.boot.context.properties.ConfigurationProperties; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; | |
import org.springframework.context.annotation.Primary; | |
import javax.sql.DataSource; |
# Credit http://stackoverflow.com/a/2514279 | |
for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ci %cr" $branch | head -n 1` \\t$branch; done | sort -r |
#!/bin/bash | |
# save this file as tailc then | |
# run as: $ tailc logs/supplier-matching-worker.log Words_to_highlight | |
file=$1 | |
if [[ -n "$2" ]]; then | |
color=' | |
// {print "\033[37m" $0 "\033[39m"} | |
/(WARN|WARNING)/ {print "\033[1;33m" $0 "\033[0m"} | |
/(ERROR|CRIT)/ {print "\033[1;31m" $0 "\033[0m"} |
package my.controllertest.controller; | |
import org.springframework.stereotype.Controller; | |
import org.springframework.web.bind.annotation.RequestMapping; | |
/** | |
* 이 문제의 수동 테스트 결과는 "/path/home" 이다.<br> | |
* 1. 자식클래스의 "path"가 부모 클래스나 인터페이스를 override했기 때문.<br> | |
* 2. 자식클래스 "path"를 제거할 경우 답은 "/if/home" 이다.<br> | |
* 3. 자식 인터페이스 "if"를 제거할 경우 답은 "/superif/home"<br> |
package com.boot; | |
import org.springframework.boot.SpringApplication; | |
import org.springframework.boot.autoconfigure.SpringBootApplication; | |
import org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration; | |
@SpringBootApplication(exclude = ThymeleafAutoConfiguration.class) | |
public class BootApplication { | |
public static void main(String[] args) { | |
SpringApplication.run(AppSecurityApplication.class, args); |
// 스프링 4.3부터 추가된 InjectionPoint를 이용한 Context-Aware Bean 생성 방법. | |
@Configuration | |
public class BeanConfig { | |
@Bean | |
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) | |
Logger logger(InjectionPoint injectionPoint) { | |
return LoggerFactory.getLogger(injectionPoint.getMethodParameter().getContainingClass()); | |
} | |
} |