Git Product home page Git Product logo

Comments (9)

simonbrowndotje avatar simonbrowndotje commented on May 21, 2024 1

Done -> fd3fd68

from java.

simonbrowndotje avatar simonbrowndotje commented on May 21, 2024

Older versions of the library used to silently ignore duplicate components, but I changed this behaviour a few months ago. Perhaps the easiest thing to do here is to add a flag (e.g. ignoreDuplicateComponents) onto the component finder strategy so that you can choose to ignore duplicate components, or not. Thoughts?

from java.

deinspanjer avatar deinspanjer commented on May 21, 2024

So I think the typical end goal for any user of a finder strategy would be to end up with a list of all the components they might care about, ideally with all of the metadata and data about that component that it is possible to discover.

In this particular case, I believe there isn't really any additional data to be discovered about a Type that will become a component even if it is discovered by two separate finder strategies.

There might be a small bit of additional metadata, depending on if the strategy sets particular tags, technologies, etc. on the components. I'm thinking about the Spring Component finders in particular, but that might happen in others as well. A hypothetical case I can think of would be a Spring Component getting annotated with the Structurizr @component annotation.

So, my preference would be to merge any metadata where it can be merged. If it can't be merged, such as a name or description, then we'd have to consider either "a last found wins" or a priority based strategy. I don't think anyone would seriously complain about the last found wins resolution, and it would probably be a lot easier to implement.

from java.

simonbrowndotje avatar simonbrowndotje commented on May 21, 2024

Perhaps the best way to deal with this is to allow people to customise what they want to do in the event that a duplicate component is found. I'm just adding some changes to support a pluggable strategy, of the form:

public interface DuplicateComponentStrategy {

    void duplicateComponentFound(Component component, String name, String type, String description, String technology);

}

You could then provide an implementation that did anything you wanted, with the default behaviour to throw a DuplicateComponentFoundException. Would that work for you?

from java.

deinspanjer avatar deinspanjer commented on May 21, 2024

Yes, I think that would work fine. I'm working on my patched version of the spring finder strategies to just add dupes as supporting types since that is the majority of the cases I'm hitting at the moment.

from java.

FreeWillaert avatar FreeWillaert commented on May 21, 2024

Hi, I'm running into a bunch of DuplicateComponentFoundExceptions - not sure why yet, still investigating - but setting my own DuplicateComponentStrategy has no effect.
The errors are a.o. about Spring Repositories.

I'm not familiar with the codebase, but I think that in method beforeFindComponents of SpringComponentFinderStrategy the setDuplicateComponentStrategy for each item of componentFinderStrategies ?

from java.

simonbrowndotje avatar simonbrowndotje commented on May 21, 2024

Thanks, I opened a new issue (#110) ... and pushed a fix that I think addresses it.

from java.

FreeWillaert avatar FreeWillaert commented on May 21, 2024

Hi, thanks for the fix! Any idea when you would push a new version to Maven Central?

from java.

simonbrowndotje avatar simonbrowndotje commented on May 21, 2024

You're welcome! I'm planning a release later this week.

from java.

Related Issues (20)

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.