Java 在我的Spring MVC应用程序中实现Spring执行器,而不添加Spring引导
目前,我有一个使用SpringMVC的遗留项目。现在需要执行弹簧引导执行器。所以我的问题是Java 在我的Spring MVC应用程序中实现Spring执行器,而不添加Spring引导,java,spring,eclipse,spring-boot,gradle,Java,Spring,Eclipse,Spring Boot,Gradle,目前,我有一个使用SpringMVC的遗留项目。现在需要执行弹簧引导执行器。所以我的问题是 我可以在我的Spring MVC应用程序中实现Spring执行器而不添加 弹簧靴 我可以同时拥有Spring boot和Spring MVC吗 应用如果是,那么怎么做 如果有人能描述它的一步一步的实现,那就太好了。 我使用Eclipse、Gradle、Tomcat来回答您的第一个问题: 是的,您可以在spring mvc项目中使用执行器。将其添加到pom.xml <dependency>
我使用Eclipse、Gradle、Tomcat来回答您的第一个问题:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-actuator</artifactId>
<version>Compatible version with mvc</version>
</dependency>
和springbootstarterweb
作为依赖项
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
org.springframework.boot
SpringBootStarterWeb
对于第一个回答步骤2,您可以在这里提到SpringServlet中的条目吗。i、 e在配置/执行器终点后,为使autowire正常工作,应传递哪些值,并且对于度量/度量应相同,但如何配置?i、 我不理解第二步。您能详细描述它吗?因为它有@Autowired注释,我们应该在哪里注入这些依赖项,以及如何注入这些依赖项?我被困在那一点上了。提前感谢创建此配置类后,您将有权访问执行器端点,您可以通过其端点调用该端点以获取有关度量等的信息,如果您想自定义默认端点返回信息,请查看执行器文档,就像EndpointHandlerMapping作为bean可用一样。这足以配置执行器。仅依靠spring引导执行器的依赖性,无法解决EndpointAutoConfiguration、PublicMetricsAutoConfiguration、HealthIndicatorAutoConfiguration和HealthIndicatorAtoConfiguration等类。我想这需要弹簧靴
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.6.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>