GithubHelp home page GithubHelp logo

robertvandeneynde / beans-graph Goto Github PK

View Code? Open in Web Editor NEW

This project forked from headstar/beans-graph

0.0 0.0 0.0 151 KB

Library to create a graph of Spring bean dependencies

License: Apache License 2.0

Java 100.00%

beans-graph's Introduction

Spring beans graph

Build Status Coverage Status

The beans-graph library creates a graph of the bean dependencies in your Spring application. The dependencies are collected at runtime. The library will help you:

  • Find cyclic dependencies in your application
  • Get an overview of your application's bean dependencies

Maven

Current version is 1.2.0.

<dependency>
    <groupId>com.headstartech.beansgraph</groupId>
    <artifactId>beansgraph-core</artifactId>
    <version>1.2.0.RELEASE</version>
</dependency>

Basic usage

Java annotation configuration:

import com.headstartech.beansgraph.BeansGraphProducer;
import com.headstartech.beansgraph.ConsoleReporter;
import com.headstartech.beansgraph.EnableBeansGraph;
import org.springframework.stereotype.Component;

@EnableBeansGraph
@Component
public class ConfigureBeanGraphReporters implements BeansGraphConfigurer {

    @Override
    public void configureReporters(BeansGraphProducer producer) {
        ConsoleReporter.forSource(producer).build();
    }
}

The example above enables the beans graph producer (@EnableBeansGraph) and configures a reporter which prints the result to the default destination (System.out).

Filter on class name:

 @Override
 public void configureReporters(BeansGraphProducer producer) {
        ConsoleReporter.forSource(producer)
        .filter(new ClassNameFilter("com.foo"))
        .build();
}

Dot reporter

To be able to generate an image with the dependencies, configure the dot reporter (http://en.wikipedia.org/wiki/DOT_%28graph_description_language%29).

Add dependency:

<dependency>
    <groupId>com.headstartech.beansgraph</groupId>
    <artifactId>beansgraph-dot-reporter</artifactId>
    <version>1.2.0.RELEASE</version>
</dependency>

Configure:

 @Override
 public void configureReporters(BeansGraphProducer producer) {
        DotReporter.forSource(producer)
            .filter(new ClassNameFilter("org.foo.bar"))
            .toOutput(new PrintWriter(new File("/tmp/dep.dot")))
            .build();
}

License

Published under Apache Software License 2.0, see LICENSE

beans-graph's People

Contributors

headstar avatar robertvandeneynde avatar

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.