相关疑难解决方法(0)

Spring启动组件扫描包括单个类

我使用spring组件扫描来自动检测bean:

@ComponentScan({"com.org.x, com.org.y"})
Run Code Online (Sandbox Code Playgroud)

问题是我想要com.org.x扫描所有类,但我想要一个单独的类com.org.y.SomeService.class,单独扫描com.org.y

我怎样才能做到这一点?

除了使用上下文扫描之外,我如何创建这个bean并注入应用程序上下文?

java spring spring-annotations spring-boot component-scan

7
推荐指数
2
解决办法
5784
查看次数