Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid duplicate classes in MergedContextConfiguration #24532

Conversation

dreis2211
Copy link
Contributor

@dreis2211 dreis2211 commented Dec 16, 2020

Hi,

I just noticed the following log while debugging some test context cache optimizations in one of my projects:

19:44:41.758 [Test worker] DEBUG o.s.t.c.s... - Before test class: context [DefaultTestContext@209b736 ... classes = '{class com.example.Application, class com.example.Application}' ...], class annotated with @DirtiesContext [false] with mode [null].

It's trimmed down, but as you can see classes contains the same class twice. This seems to be happen when I explicitly declare the classes on @SpringBootTest as follows:

@SpringBootTest(classes = {Application.class})

While not critical at all, I guess we can make an effort to avoid the duplicates. That should fix the logs and maybe saves a few cycles on the road (although that impact should be veeery small as the duplicates are filtered in SpringApplication the latest).

Let me know what you think.
Cheers,
Christoph

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Dec 16, 2020
@philwebb philwebb added for: stackoverflow A question that's better suited to stackoverflow.com type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged for: stackoverflow A question that's better suited to stackoverflow.com labels Dec 16, 2020
@philwebb philwebb added this to the 2.3.x milestone Dec 16, 2020
@philwebb philwebb added the for: merge-with-amendments Needs some changes when we merge label Dec 16, 2020
philwebb pushed a commit that referenced this pull request Dec 16, 2020
Remove duplicate config attribute classes by using a `Set` rather
than a `List` in the `SpringBootTestContextBootstrapper`.

See gh-24532
@philwebb philwebb closed this in 2cd1459 Dec 16, 2020
@philwebb philwebb removed the for: merge-with-amendments Needs some changes when we merge label Dec 16, 2020
@philwebb philwebb modified the milestones: 2.3.x, 2.3.8 Dec 16, 2020
@philwebb
Copy link
Member

Thanks @dreis2211. I merged this into 2.3.x, 2.4.x and master.

@dreis2211
Copy link
Contributor Author

dreis2211 commented Dec 16, 2020

@philwebb Thanks. On that note: is there a 2.5.x / master pipeline on Concourse yet?

@snicoll
Copy link
Member

snicoll commented Dec 17, 2020

is there a 2.5.x / master pipeline on Concourse yet?

Yes

@dreis2211
Copy link
Contributor Author

@snicoll Thanks, but the page is blank for me. Also, the build status badge inside the README can't be displayed at the moment. Seems like a permission problem.

@wilkinsona
Copy link
Member

The pipeline should be visible now.

@dreis2211
Copy link
Contributor Author

Indeed. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants