Coder Social home page Coder Social logo

erp-hs's Introduction

erp-hs's People

Contributors

hjjae2 avatar

Stargazers

 avatar

Watchers

 avatar

erp-hs's Issues

MapStruct

MapStruct

https://mapstruct.org/documentation/stable/reference/html/

μ•„λž˜μ™€ 같이 μ‚¬μš©ν•œλ‹€λ©΄, lombok 의 annotation 을 μ‚¬μš©ν•  수 μžˆλ‹€.

annotationProcessor 'org.projectlombok:lombok'
annotationProcessor 'org.mapstruct:mapstruct-processor:1.4.2.Final'

μ•„λž˜μ™€ 같이 μ‚¬μš©ν•œλ‹€λ©΄, lombok 의 annotation 을 μ‚¬μš©ν•  수 μ—†λ‹€. λ”°λΌμ„œ getter, setter 등을 직접 κ΅¬ν˜„ν•΄μ£Όμ–΄μ•Ό ν•œλ‹€.

annotationProcessor 'org.mapstruct:mapstruct-processor:1.4.2.Final'
annotationProcessor 'org.projectlombok:lombok'

@Generated(
    value = "org.mapstruct.ap.MappingProcessor",
    date = "2021-08-07T18:03:07+0900",
    comments = "version: 1.4.2.Final, compiler: IncrementalProcessingEnvironment from gradle-language-java-7.1.1.jar, environment: Java 1.8.0_281 (Oracle Corporation)"
)
public class PersonMapperImpl implements PersonMapper {

    @Override
    public PersonRequestDto person2PersonRequestDto(Person person) {
        if ( person == null ) {
            return null;
        }

        PersonRequestDto personRequestDto = new PersonRequestDto();

        personRequestDto.setPhone( personPhoneValue( person ) );

        return personRequestDto;
    }

    @Override
    public PersonResponseDto person2PersonResponseDto(Person person) {
        if ( person == null ) {
            return null;
        }

        PersonResponseDto personResponseDto = new PersonResponseDto();

        personResponseDto.setPhone( personPhoneValue( person ) );

        return personResponseDto;
    }
...

https://mapstruct.org/documentation/stable/reference/html/#mapping-with-constructors

μœ„μ— 글을 μ°Έμ‘°ν•˜λ©΄ μ•Œ 수 μžˆλ“―μ΄, 'μƒμ„±μž 방식'을 μ‚¬μš©ν•œ Mapper μ—μ„œλŠ” μš°μ„ μˆœμœ„κ°€ μžˆλ‹€.

  1. @Default
  2. NoArgsConstructor
  3. κ·Έ μ™Έ (μœ νš¨ν•œ) public constructor (ex. AllArgsConstructor)
  4. λ§Œμ•½ μœ νš¨ν•œ public constructor κ°€ μ—¬λŸ¬ 개라면 컴파일였λ₯˜κ°€ λ°œμƒν•  것이며 @Default μ–΄λ…Έν…Œμ΄μ…˜μ„ λͺ…μ‹œν•΄μ€˜μ•Όν•œλ‹€.

[TIP] @NoArgsConstructor κ°€ μ‚¬μš©λœλ‹€λ©΄, setter λ©”μ„œλ“œκ°€ ν•„μš”ν•˜λ‹€. λΆˆν•„μš”ν•œ setter λ₯Ό λ§Œλ“€κ³  싢지 μ•Šμ•„ @AllArgsConstructor 방식을 μ΄μš©ν•˜κ²Œ μœ λ„ν•˜μ˜€λ‹€.

Directory

image

여기에 mapper κ΄€λ ¨ package , class λ₯Ό μΆ”κ°€ν•˜κ³  μ‹Άλ‹€λ©΄ ?

image

곡톡(?)에 κ΄€λ ¨λœ class λŠ” μ–΄λ–€ νŒ¨ν‚€μ§€μ—?

[AOP] Logging for rest controller

[AOP] Logging for rest controller

  1. @within vs @target 차이점에 λŒ€ν•΄ μ•Œμ•„λ³Ό 것
@Log4j2
@Aspect
@Component
public class Log4RestControllerAspect {

    @Around("@within(com.hserp.annotation.Log4RestController)")
    public Object log4RequestAndResponse(ProceedingJoinPoint joinPoint) throws Throwable {
        log.info("Before!");
        Object proceed = joinPoint.proceed();
        log.info("After!");
        return proceed;
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.