我正在开发一个库xyz.jar,需要添加一个具有如下映射的 UI 页面:
@RestController
public class LibCtrl {
@EventListener(ApplicationReadyEvent.class)
@RequestMapping("/updateDomainList")
String updateDomainList() {
return "we can call a controller from another jar like this";
}
}
Run Code Online (Sandbox Code Playgroud)
然后需要在我的主 springboot 应用程序中调用,myMainApplication.war所以当我调用
http://localhost/myMainApplication/updateDomainList
我应该看看
we can call controller from another jar like this
Run Code Online (Sandbox Code Playgroud)
在浏览器上。
如何才能实现这一点呢?@Component也不适合我。一旦开始起作用,是否@Autowired也JdbcTemplate起作用?
spring-boot ×1