1717import com .github .codeboyzhou .mcp .declarative .server .factory .McpStdioServerFactory ;
1818import com .github .codeboyzhou .mcp .declarative .server .factory .McpStreamableServerFactory ;
1919import com .google .inject .AbstractModule ;
20- import com .google .inject .Provides ;
21- import com .google .inject .Singleton ;
2220import com .google .inject .name .Names ;
2321import java .util .Set ;
2422import org .reflections .Reflections ;
@@ -33,15 +31,6 @@ public InjectorModule(Class<?> mainClass) {
3331 this .mainClass = mainClass ;
3432 }
3533
36- @ Provides
37- @ Singleton
38- @ SuppressWarnings ("unused" )
39- public Reflections provideReflections () {
40- McpServerApplication application = mainClass .getAnnotation (McpServerApplication .class );
41- final String basePackage = determineBasePackage (application );
42- return new Reflections (basePackage , TypesAnnotated , MethodsAnnotated , FieldsAnnotated );
43- }
44-
4534 @ Override
4635 protected void configure () {
4736 // Bind classes annotated by McpResources, McpPrompts, McpTools
@@ -70,6 +59,12 @@ protected void configure() {
7059 .toInstance (i18nEnabled );
7160 }
7261
62+ private Reflections provideReflections () {
63+ McpServerApplication application = mainClass .getAnnotation (McpServerApplication .class );
64+ final String basePackage = determineBasePackage (application );
65+ return new Reflections (basePackage , TypesAnnotated , MethodsAnnotated , FieldsAnnotated );
66+ }
67+
7368 private String determineBasePackage (McpServerApplication application ) {
7469 if (application != null ) {
7570 if (!application .basePackage ().trim ().isBlank ()) {
0 commit comments