【发布时间】:2021-10-26 03:20:14
【问题描述】:
我正在配置 shiro-spring-starter。
@Configuration
public class ShiroConfig {
@Bean
public Realm realm() {
return new UserRealm();
}
}
\\Without @Component
public class UserRealm extends AuthorizingRealm {
@Autowired
private UserMapper userMapper;
}
UserRealm 是使用“new UserRealm()”创建的,没有 @Component。 为什么@Autowired 工作?
【问题讨论】:
标签: spring spring-mvc shiro