All Projects → jillesvangurp → Spring Depend

jillesvangurp / Spring Depend

Licence: mit
Tool for getting a spring bean dependency graph

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Spring Depend

Scabbard
🗡 A tool to visualize Dagger 2 dependency graphs
Stars: ✭ 615 (+2096.43%)
Mutual labels:  dependency-graph, dependency-injection
Autofac.annotation
Autofac extras library for component registration via attributes 用注解来load autofac 摆脱代码或者xml配置和java的spring的注解注入一样的体验
Stars: ✭ 140 (+400%)
Mutual labels:  spring, dependency-injection
Spring Data Neo4j
Provide support to increase developer productivity in Java when using Neo4j. Uses familiar Spring concepts such as a template classes for core API usage and lightweight repository style data access.
Stars: ✭ 662 (+2264.29%)
Mutual labels:  neo4j, spring
Kotlin Mvvm Architecture
Android Architecture Design Patterns using Kotlin, MVVM, Dagger2, LiveData, Room, MediatorLiveData, NetworkBoundResources, Retrofit, AndroidX, ViewModels, Dependency Injection using Dagger2, Repository pattern.
Stars: ✭ 126 (+350%)
Mutual labels:  dependency-graph, dependency-injection
Go Spring
基于 IoC 的 Go 后端一站式开发框架 🚀
Stars: ✭ 744 (+2557.14%)
Mutual labels:  spring, dependency-injection
Chess
An online chessboard made with Spring, JSF 2 and Primefaces.
Stars: ✭ 8 (-71.43%)
Mutual labels:  spring
Ssm redis template
An template based on Maven, using Spring + Spring MVC + mybatis + spring-data-redis frames. It can be used to construct a new Java Web Appliaction quickly
Stars: ✭ 13 (-53.57%)
Mutual labels:  spring
R2d2 Cypher
Cypher support for the r2d2 connection pool
Stars: ✭ 8 (-71.43%)
Mutual labels:  neo4j
Neo4jd3
Neo4j graph visualization using D3.js
Stars: ✭ 843 (+2910.71%)
Mutual labels:  neo4j
Mydi
moved to https://github.com/cekta/di
Stars: ✭ 21 (-25%)
Mutual labels:  dependency-injection
Ruoyi
(RuoYi)官方仓库 基于SpringBoot的权限管理系统 易读易懂、界面简洁美观。 核心技术采用Spring、MyBatis、Shiro没有任何其它重度依赖。直接运行即可用
Stars: ✭ 905 (+3132.14%)
Mutual labels:  spring
Tiny Spring
本项目是一个精简版的spring,通过自己实现一遍spring来理解spring框架的精华。
Stars: ✭ 13 (-53.57%)
Mutual labels:  spring
Openespi Datacustodian Java
Spring Framework implementation of a Green Button Data Custodian OpenESPI Application
Stars: ✭ 9 (-67.86%)
Mutual labels:  spring
Inji
a dependency inject container for golang (golang inject), objects will be closed on a reverse order of their creation
Stars: ✭ 13 (-53.57%)
Mutual labels:  dependency-injection
Workflow Service Activiti
workflow service extensions built on Bpmn 2.0 & Activiti 5.13
Stars: ✭ 8 (-71.43%)
Mutual labels:  spring
Angular7 Springboot Crud Tutorial
Develop a single page application(SPA) using Angular 7 as a front-end and Spring boot restful API as a backend.
Stars: ✭ 21 (-25%)
Mutual labels:  spring
Springbootunity
rabbitmq、redis、scheduled、socket、mongodb、Swagger2、spring data jpa、Thymeleaf、freemarker etc. (muti module spring boot project) (with spring boot framework,different bussiness scence with different technology。)
Stars: ✭ 845 (+2917.86%)
Mutual labels:  spring
Spring Reactive Sample
Spring 5 Reactive playground
Stars: ✭ 867 (+2996.43%)
Mutual labels:  spring
Codewif
An Android framework that provides in-app testing
Stars: ✭ 15 (-46.43%)
Mutual labels:  dependency-injection
Spring Cloud Examples
Examples of microservice instrastructures
Stars: ✭ 11 (-60.71%)
Mutual labels:  spring

Spring-depend

Tool for analyzing spring dependencies & exporting your dependencies to neo4j. Similar tools exist but they seem to be bundled with complicated IDE plugins or other stuff I don't really need/use. This makes standalone usage a bit hard. This is a standalone thing. All you need to use this is a spring application context.

To use:

  • Add the dependency to spring-depend to your existing spring project
  • Get a reference to your application context in one of the several ways that spring allows you to do this. Any instance of spring's GenericApplicationContext or one of the sub classes should work
  • Do something like this:
SpringDependencyAnalyzer analyzer = new SpringDependencyAnalyzer(context);
analyzer.printReport();
System.out.println(analyzer.beanGraphCypher()) // copy paste in neo4j console & enjoy!

Features:

  • Map<String, Set<String>> getBeanDependencies() returns a map of all the beans in your context and their dependencies. Needing lots of things is a sign of low coherence and high coupling.
  • Map<String, Set<String>> getReverseBeanDependencies() returns reverse dependencies. Being used a lot is a good thing; it indicates usefulness. Things that are rarely used might not need to be beans on the other hand.
  • SimpleGraph<String> getBeanGraph() a graph of the dependencies. (TODO: technically this is a reverse dependency graph that is generated from both the dependency and reverse dependency map. I need to add the ability to invert it.)
  • SimpleGraph<Class<?>> getConfigurationGraph(Class<?> configurationClass) return a graph of your @Configuration classes by following the imports from the specified root class.
  • Map<Integer, Set<Class<?>>> getConfigurationLayers(Class<?> configurationClass) returns a tree map with the configuration classes ordered in layers by their dependencies on each other. The more layers you need, the more complex your spring dependencies are. Consider refactoring them to have less interdependencies. Untangling the the most coupled beans will likely clear this up.
  • String configurationGraphCypher(Class<?>) returns neo4j cypher for your Spring configuration import dependencies in neo4j
  • String beanGraphCypher() returns neo4j cypher for creating your spring bean dependency graph in neo4j
  • String getCircularDependencyStatisticJson() return json report with all circular bean dependency. For example:
     {
         "createDate": "Feb 28, 2020 11:04:40 AM",
         "allBeanCircularDependencyCount": 19,
         "dependencyMap": {
           "bean7": {
             "injectedBeanCount": 1,
             "injectedBeanNames": [
               "bean6"
             ],
             "circularDependencyCount": 5,
             "circularDependencyDescriptions": [
               "bean7-bean6-bean7",
               "bean7-bean6-bean5-bean4-bean1-bean7",
               "bean7-bean6-bean5-bean4-bean3-bean7",
               "bean7-bean6-bean5-bean7",
               "bean7-bean6-bean5-bean4-bean7"
             ]
           },
           "bean6": {
             "injectedBeanCount": 2,
             "injectedBeanNames": [
               "bean5",
               "bean7"
             ],
             "circularDependencyCount": 4,
             "circularDependencyDescriptions": [
               "bean6-bean5-bean4-bean7-bean6",
               "bean6-bean5-bean4-bean1-bean3-bean7-bean6",
               "bean6-bean5-bean4-bean1-bean7-bean6",
               "bean6-bean5-bean7-bean6"
             ]
           }
     }
    

Future work

When time allows, I might work on these topics a bit. Pull requests are welcome of course.

  • Better graph implementation than the rather limited SimpleGraph currently included. This was a quick and dirty job but it seems good enough.
  • Fix the bean graph to not be a reverse dependency graph.
  • Simple metrics for coherence and coupling.
  • Test framework support so you can assert constraints on your dependencies and related metrics from a simple unit test.

Get it from Maven Central

<dependency>
    <groupId>com.jillesvangurp</groupId>
    <artifactId>spring-depend</artifactId>
    <!-- check maven central for latest, Readme's get out of date so easily ... -->
    <version>0.2</version>
</dependency>

Note. the spring dependency in the pom is optional. This is so you can specify which spring version you use and avoid nasty conflicts. Anything recent (4.x and up) should pretty much work with this and perhaps older versions too.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].