Git Product home page Git Product logo

spring-legacy's Introduction

Spring Legacy

When migrating a legacy project to dependency injection based on Spring you often need dependencies to be injected found in legacy code which has no Spring support. This library provides class path scanning to create bean definitions for typical singleton and factory patterns found in legacy code. You may also access Spring beans from legacy code.

Usage

Using Spring beans from legacy code

To use a singleton bean from a Spring context, you should obtain it using LegacySpringAccess.getSpringBean(). Have a look into the example and how it is used in the integration test. The usage has to be prepared using a Spring configuration including the LegacySpringAccess which can be easily imported from your own configuration.

Using legacy singletons with Spring

Instead of directly access legacy singletons from new code, you should use DI as provided by Spring. To support this, register all singletons from legacy code as Spring beans. The post processor is configured using a static bean method in your config. Have a look into the example and how it is used in the integration test.

Dependency Release

To integrate the library in your project, add the artifact spring-legacy of group de.diergo to your Java dependency management. At JitPack you can find examples for Gradle and Maven.

The library has no external dependencies except Spring Framework (spring-context starting with 5.1.0.RELEASE). For the release notes, have a look at the change log.

License

This library is published under Apache License Version 2.0.

spring-legacy's People

Contributors

aburmeis avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

spring-legacy's Issues

Allow legacy singletons to be used as spring beans

Register bean definitions for all singletons found on a class path. May be restrict by base packages, field and method names. Must not initialize classes in introspections as this may lead into other loading problems due to transitive dependencies.

Support legacy factory results as beans

Allow specific types to be configured as factories so the creation methods can create beans. For each type the method names can be restricted and they can become scope prototype. You can define a singleton as a factory or just static methods.

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.