【发布时间】:2016-09-29 13:25:02
【问题描述】:
Spring Boot 不会自动装配我从另一个 Web 应用程序导出的 MBean:
@Component
@Service
@ManagedResource(objectName = IHiveService.MBEAN_NAME)
public class HiveService implements IHiveService {
@Autowired(required = true)
CategoryRepository categoryRepository;
@Override
@ManagedOperation
public String echo(String input) {
return "you said " + input;
}
}
我可以在 Oracle Java Mission Control 中看到和使用 Bean,但其他 Spring Boot 应用程序无法自动装配 bean。我错过了一个注释。要自动装配我使用的 bean:
@Controller
@Configuration
@EnableMBeanExport
public class GathererControls {
@Autowired
IHiveService hiveService; // <-- this should be auto wired
有什么想法吗?
【问题讨论】:
-
@Controller和@Configuration在同一个班级??这可能吗? -
@PauChorro 我绝望了,尝试了一切......
标签: spring-boot jmx autowired spring-jmx