我有一个多模块的maven-spring项目。以下是结构
ParentService
---web
---service
---mapper我在web中有应用程序类,我使用eureka并在web中编写了一些控制器类。
@SpringBootApplication()
@MapperScan(basePackages = {xxx})
@Configuration
@EnableScheduling
@EnableEurekaClient
@EnableTransactionManagement(proxyTargetClass = true)
public class FrontApplication extends SpringBootServletInitializer {现在我想调用服务模块中的另一个微服务
我想要一个简单的方法来调用另一个微服务,如restTemplate.postForObject()或feign,但是服务模块中没有springcloud,我是否需要在服务模块中编写另一个springcloud配置文件和应用类?请给我一些建议。
如果我直接在服务模块组件http中调用微服务,我就不能扮演eureka的角色,也不能做负载均衡。
请给我一些建议。我需要更改我的项目架构吗?
发布于 2019-02-14 14:43:34
如果你将这三个模块(web,service,mapper)作为独立的spring启动模块,并依赖于spring cloud,那会更好。扩展和负载平衡将会很容易。
https://stackoverflow.com/questions/54684345
复制相似问题