0
春天開機不會自動裝配一個MBean的,我從另一個Web應用程序導出的:Spring Boot autowire 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;
}
}
我可以看到在甲骨文的Java任務控制,但其他的Spring應用程序啓動使用Bean是不能夠自動裝配豆。我這是我錯過了一個註釋。自動裝配我使用的豆:
@Controller
@Configuration
@EnableMBeanExport
public class GathererControls {
@Autowired
IHiveService hiveService; // <-- this should be auto wired
任何想法?
'@ Controller'和'@ Configuration'在同一個班?那可能嗎? – Pau
@PauChorro我得到絕望,並嘗試了一切...... –