You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Both of these attempts to search for Repository sub-types within the org.tamarack.models package returned classes outside of org.tamarack.models:
new Reflections(new ConfigurationBuilder().forPackages("com.tamarack.models"))
.getSubTypesOf(Repository.class);
new Reflections("com.tamarack.models")
.getSubTypesOf(Repository.class);
In particular, org.springframework.data.repository.PagingAndSortingRepository and org.springframework.data.repository.CrudRepository were returned in addition to the expected results. I would expect Reflections to only return classes in the package com.tamarack.models for both of those calls. Lmk if I'm using the library wrong!
The text was updated successfully, but these errors were encountered:
I've the same issue when she package is part of another Jar file. I debugged into Reflections and noticed that in my case reason ist that the expansion of the URL of the package in the Jar discards the Package part and only keeps the jar-file part. So it scanned everything in the jar file.
I solved this by adding a filter to the configuration like that:
Reflections reflections = new Reflections(
new ConfigurationBuilder().forPackages(exampleClass.getPackageName())
.filterInputsBy(fn -> fn.contains(exampleClass.getPackageName()))
);
Both of these attempts to search for
Repository
sub-types within theorg.tamarack.models
package returned classes outside oforg.tamarack.models
:In particular,
org.springframework.data.repository.PagingAndSortingRepository
andorg.springframework.data.repository.CrudRepository
were returned in addition to the expected results. I would expect Reflections to only return classes in the packagecom.tamarack.models
for both of those calls. Lmk if I'm using the library wrong!The text was updated successfully, but these errors were encountered: