Beans graph

Core library generating a graph of Spring bean dependencies

License

License

GroupId

GroupId

com.headstartech.beansgraph
ArtifactId

ArtifactId

beansgraph-core
Last Version

Last Version

1.2.0.RELEASE
Release Date

Release Date

Type

Type

jar
Description

Description

Beans graph
Core library generating a graph of Spring bean dependencies
Project URL

Project URL

https://github.com/headstar/beans-graph
Source Code Management

Source Code Management

https://github.com/headstar/beans-graph

Download beansgraph-core

How to add to project

<!-- https://jarcasting.com/artifacts/com.headstartech.beansgraph/beansgraph-core/ -->
<dependency>
    <groupId>com.headstartech.beansgraph</groupId>
    <artifactId>beansgraph-core</artifactId>
    <version>1.2.0.RELEASE</version>
</dependency>
// https://jarcasting.com/artifacts/com.headstartech.beansgraph/beansgraph-core/
implementation 'com.headstartech.beansgraph:beansgraph-core:1.2.0.RELEASE'
// https://jarcasting.com/artifacts/com.headstartech.beansgraph/beansgraph-core/
implementation ("com.headstartech.beansgraph:beansgraph-core:1.2.0.RELEASE")
'com.headstartech.beansgraph:beansgraph-core:jar:1.2.0.RELEASE'
<dependency org="com.headstartech.beansgraph" name="beansgraph-core" rev="1.2.0.RELEASE">
  <artifact name="beansgraph-core" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.headstartech.beansgraph', module='beansgraph-core', version='1.2.0.RELEASE')
)
libraryDependencies += "com.headstartech.beansgraph" % "beansgraph-core" % "1.2.0.RELEASE"
[com.headstartech.beansgraph/beansgraph-core "1.2.0.RELEASE"]

Dependencies

compile (3)

Group / Artifact Type Version
org.jgrapht : jgrapht-core jar 0.9.0
org.springframework : spring-context jar 3.2.10.RELEASE
org.slf4j : slf4j-api jar 1.7.5

test (2)

Group / Artifact Type Version
ch.qos.logback : logback-classic jar 1.0.13
org.testng : testng jar 6.8.7

Project Modules

There are no modules declared in this project.

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

Versions

Version
1.2.0.RELEASE
1.1.2.RELEASE
1.1.1.RELEASE
1.1.0.RELEASE
1.0.0.RELEASE