Git Product home page Git Product logo

spring-configurable's Introduction

Spring @Configurable

스프링프레임워크 2.5 부터 지원된 Entity와 같은 도메인 모델에서 DI를 받기 위한 기술

특정 도메인 객체에 @Configurable 를 선언하고 도메인 내 필드에 @Autowired를 이용해 의존성을 주입시키면 Spring bean이 주입되는 설정이 가능함

Production Code

@Data
@Configurable
public class Entity {
    @Autowired
    private EntityRepository repository;
    
    private Long entityNo;
    private String description;
}

Test Code

@Test
public void newEntity() {
    Entity entity = new Entity();
    assertThat(entity.getRepository(), is(notNullValue()));
}

이런 것이 가능해진다

궁극적으로 스프링에서 DDD를 지원하기 위한 포석이었다.

하지만

LTW, CTW를 적용하는 설정의 허들이 존재하기 때문에 적용이 쉽지 많은 않다. 또한 객체 디자인 적으로 객체 간 의존이 심해지고 대체할 수 있는 도메인 이벤트와 같은 방법이 제시 되면서 사장된 것 같다. 그래도 필요 시 사용하면 좋은 기술임에는 분명하다

개인적 경험 상 커맨드 패턴과 같은 곳에 적용하면 좋았다.

spring-configurable's People

Stargazers

xephysis avatar Joshua. avatar

Watchers

James Cloos avatar Jordan(정명주) avatar

Forkers

xiaomin0322

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.