春季@Component课程必须公开吗?
我想将组件的接口公开为接口,并且实现类将受到包保护(也许在其他包中):
package baz.iface
interface Foo {
void bar();
}
package baz.whatever
@Component
class SpringyFoo implements baz.iface.Foo {
public void bar() { frobnicate(); }
}
假设在,Spring能够自动连接其他地方吗?baz.whatever
component-scan
baz.iface.Foo
class FooClient {
@Autowired
private baz.iface.Foo;
}