Skip to content

Issues with gRPC and actuator #117

@micheleorsi

Description

@micheleorsi

The context

I've tried the example and I would like to just make it working with the actuator

The bug

Application doesn't start

Stacktrace and logs

2025-02-26T15:41:16.883Z  WARN 47594 --- [demo] [           main] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.actuate.autoconfigure.metrics.task.TaskExecutorMetricsAutoConfiguration': Injection of autowired dependencies failed

***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    org.springframework.boot.actuate.autoconfigure.metrics.task.TaskExecutorMetricsAutoConfiguration.bindTaskExecutorsToRegistry(TaskExecutorMetricsAutoConfiguration.java:60)

The following method did not exist:

    'java.util.Map org.springframework.beans.factory.support.SimpleAutowireCandidateResolver.resolveAutowireCandidates(org.springframework.beans.factory.config.ConfigurableListableBeanFactory, java.lang.Class)'

The calling method's class, org.springframework.boot.actuate.autoconfigure.metrics.task.TaskExecutorMetricsAutoConfiguration, was loaded from the following location:

    jar:file:/Users/<user>/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-actuator-autoconfigure/3.5.0-SNAPSHOT/f51df18a3d269bceae756f193f38c3ff0e697fd6/spring-boot-actuator-autoconfigure-3.5.0-SNAPSHOT.jar!/org/springframework/boot/actuate/autoconfigure/metrics/task/TaskExecutorMetricsAutoConfiguration.class

The called method's class, org.springframework.beans.factory.support.SimpleAutowireCandidateResolver, is available from the following locations:

    jar:file:/Users/<user>/.gradle/caches/modules-2/files-2.1/org.springframework/spring-beans/6.2.1/ab57ec03ba6900075bf28e3cd70ccce173205b8d/spring-beans-6.2.1.jar!/org/springframework/beans/factory/support/SimpleAutowireCandidateResolver.class

The called method's class hierarchy was loaded from the following locations:

    org.springframework.beans.factory.support.SimpleAutowireCandidateResolver: file:/Users/<user>/.gradle/caches/modules-2/files-2.1/org.springframework/spring-beans/6.2.1/ab57ec03ba6900075bf28e3cd70ccce173205b8d/spring-beans-6.2.1.jar


Action:

Correct the classpath of your application so that it contains compatible versions of the classes org.springframework.boot.actuate.autoconfigure.metrics.task.TaskExecutorMetricsAutoConfiguration and org.springframework.beans.factory.support.SimpleAutowireCandidateResolver



Steps to Reproduce

Steps to reproduce the behavior:

./gradlew clean bootRun

The application's environment

Which versions do you use?

build.gradle.kts

import com.google.protobuf.gradle.id

plugins {
	kotlin("jvm") version "1.9.25"
	kotlin("plugin.spring") version "1.9.25"
	id("org.springframework.boot") version "3.5.0-SNAPSHOT"
	id("io.spring.dependency-management") version "1.1.7"
	id("com.google.protobuf") version "0.9.4"
}

group = "com.example"
version = "0.0.1-SNAPSHOT"

java {
	toolchain {
		languageVersion = JavaLanguageVersion.of(21)
	}
}

repositories {
	mavenCentral()
	maven { url = uri("https://repo.spring.io/milestone") }
	maven { url = uri("https://repo.spring.io/snapshot") }
}

extra["springGrpcVersion"] = "0.3.0"

dependencies {
	implementation("org.springframework.boot:spring-boot-starter-actuator")
	implementation("io.grpc:grpc-services")
	implementation("org.jetbrains.kotlin:kotlin-reflect")
	implementation("org.springframework.grpc:spring-grpc-spring-boot-starter")
	testImplementation("org.springframework.boot:spring-boot-starter-test")
	testImplementation("org.jetbrains.kotlin:kotlin-test-junit5")
	testImplementation("org.springframework.grpc:spring-grpc-test")
	testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}

dependencyManagement {
	imports {
		mavenBom("org.springframework.grpc:spring-grpc-dependencies:${property("springGrpcVersion")}")
	}
}

kotlin {
	compilerOptions {
		freeCompilerArgs.addAll("-Xjsr305=strict")
	}
}

protobuf {
	protoc {
		artifact = "com.google.protobuf:protoc"
	}
	plugins {
		id("grpc") {
			artifact = "io.grpc:protoc-gen-grpc-java"
		}
	}
	generateProtoTasks {
		all().forEach {
			it.plugins {
				id("grpc") {
					option("jakarta_omit")
					option("@generated=omit")
				}
			}
		}
	}
}

tasks.withType<Test> {
	useJUnitPlatform()
}

Additional context

  • Did it ever work before?

without this line it just works

implementation("org.springframework.boot:spring-boot-starter-actuator")
  • Have you tried also with other versions?

yes, with the following

  • 3.5.0 (SNAPSHOT)
  • 3.5.0 (M2)
  • 3.4.3

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions