小编ref*_*mon的帖子

Micronaut - Springframework @Bean 等效项是什么?

我对 Micronauts 非常陌生,并且在开发 Spring Boot 应用程序方面有相当多的经验。有了这个背景,我偶然发现了创建自定义 bean,就像我过去@Bean在 Spring 应用程序上使用注释创建的方式一样。就我而言,我有一个提供接口及其实现类的库。我想在代码中使用该接口并尝试注入实现,但失败并出现以下错误

Caused by: io.micronaut.context.exceptions.NoSuchBeanException: No bean of type [io.vpv.saml.metadata.service.MetaDataParser] exists for the given qualifier: @Named('MetaDataParserImpl'). Make sure the bean is not disabled by bean requirements (enable trace logging for 'io.micronaut.context.condition' to check) and if the bean is enabled then ensure the class is declared a bean and annotation processing is enabled (for Java and Kotlin the 'micronaut-inject-java' dependency should be configured as an annotation processor).
Run Code Online (Sandbox Code Playgroud)

这是我的代码

Caused by: io.micronaut.context.exceptions.NoSuchBeanException: No …
Run Code Online (Sandbox Code Playgroud)

java spring inversion-of-control micronaut

4
推荐指数
1
解决办法
6630
查看次数

标签 统计

inversion-of-control ×1

java ×1

micronaut ×1

spring ×1