
[英]Use a custom mapper inside another custom mapper with mapstruct (in default method)
我想在 MapperA 的默认方法中使用 MapperB 类似于这个问题: How can I use another mapping from different class in mapstruct 然而 afaik 这个问题并没有要求“自定义映射器”,即作为自己的界面存在的映射器。 我怎么能 ...
[英]Use a custom mapper inside another custom mapper with mapstruct (in default method)
我想在 MapperA 的默认方法中使用 MapperB 类似于这个问题: How can I use another mapping from different class in mapstruct 然而 afaik 这个问题并没有要求“自定义映射器”,即作为自己的界面存在的映射器。 我怎么能 ...
[英]@Autowired not working in multi-module application
我需要@Autowire 数据库服务或存储库形成“游戏”模块中的“数据库”模块。 已经在主“应用程序”class 中添加了这些注释: 将它们添加到构造函数中要困难得多,因为我需要在 StrategySelector 中创建这些类的实例列表: 或者,对于 StrategySelector 逻辑,也许有 ...
[英]Create a Spring Bean programmatically, but with Autowired within it
如何实例化其中包含一些@Autowired bean 的 Spring Bean? 需要注意的是,实例 bean 类型必须在运行时动态发现(而@Autowired bean 仍然可以是单例)。 例子: 界面 ClientA.class 客户端B.class ClientFactory.clas ...
[英]@Autowired : No qualifying bean of type available SpringBoot application
我在库中定义了一个接口com.myapp.org.UsageRateLimiter 我有一个具体的 class SlidingWindowRateLimiter : 另一个 class com.myapp.org.RateLimitDriver引用了UsageRateLimiter类型的 obje ...
[英]how to use constructor autowried
我可以使用现场自动装配让它工作。 我想使用自动构造函数。 当我不添加任何构造器,或者我使用@NoArgsConstructor 或@RequiredArgsConstructor 时,url 具有价值。 但是restTemplate是null 如果我使用@AllArgsConstructor,它会给 ...
[英]Repository that extends JpaRepository cannot be autowired into my Service
我有扩展 Jpa 存储库接口的 UserRepository 接口,当我试图将它自动连接到服务或 Controller 时,我收到这样的错误 - 我的项目结构以防万一 -单击用户资料库 - 服务 - 实体 - 如果它还不够回答我可以提供更多信息我是 Spring Boot 的新手,希望有人能提供帮助 ...
[英]why Service is not taking by the Service implementation?
这是我的服务:这是我的服务实现: 这是 output 结果: ...
[英]Even though I have autowired the entity in my ServiceImpl class, its still giving me the error related to autowire
这是我的 Impl Class 这是我得到的错误 我尝试重做这些步骤,但问题仍然存在 ...
[英]Could not autowire. No beans of 'AuthenticationEntryPoint' type found
当我自动装配除我创建的类之外的任何 class 时,我会收到这样的警告。 IDE:IntelliJ IDEA 2022.3.1 Spring 引导版本:2.7.4 警告: 保安 class 配置 class 为我创建的 Class ComponentScan spring.工厂 我自己的班级 ...
[英]How to declare parameters of a service of my bundle
我正在为几个 Symfony 项目创建一个包。 这个包包含一个服务,这个服务是用一个构造函数创建的,这个构造函数包含一个数组作为第一个和唯一的参数。 使用我的包的开发人员必须在config/properties.yaml文件中声明这个数组。 下面是如何加载config/properties.yaml ...
[英]Cannot autowire service ServiceEntityRepository no such service exists. Symfony under API Platform
我们正在使用 API 平台构建我们的应用程序,我们陷入了一个看起来与我们相关的环境的错误。 我们是 4 个开发人员,我们中的 3 个在 windows 下有同样的问题,而在 mac os 下的一个无法重现它并且一切正常。 我们正在与官方 docker 合作,我们都更新了它。 我已经尝试了我可以在谷 ...
[英]Generic type reverse lookup with Spring Boot @Service autowirings
此处为 Spring Boot 和 Java 11。 我有一个抽象基类: 还有一些子类,比如: 但是除了这三个之外,它还有更多的子类。 我也有一个界面: 所以接口的每个实现都必须指定它所操作的AbstractBurninator子类。 因此我有: public class DoesFizzThing ...
[英]No qualifying bean of type available: expected at least 1 bean which qualifies as autowire candidate
我正在学习 Spring 依赖注入,为此我编写了一些简单的代码,但我经常遇到这个错误: 谁能指出我正确的方向? 谢谢! 服务.java Controller.java SpringTest2Application.java 我尝试了 @Component 和 @Autowired 注释的不同组合 ...
[英]Spring Boot autowire not working. Required bean, of type that could not found
在 spring 引导中使用 autowire 时出现以下错误 自动装配,来自 ServiceImpl class,调用 controller 我的存储库界面: 服务接口: ` 主 class:` 我的 pom.xml 依赖项: 我的项目结构我已经尝试了一切。 这些类的顺序肯定是正确的,它们位于 ...
[英]JUnit not Initializing Services Parameters
我有一个 SpringBoot 应用程序,基本上具有类似于以下的结构: 应用: 第一服务: 第二项服务: 我有一个 junit,如下所示: 当我执行 testMyService 时,我抛出了一个异常,基本上是这样的: 该应用程序运行良好。 我认为我设置 junit 的方式会简单地启动 springb ...
[英]How to inject env VARS into abstract class in a Symfony54 php81 app
我最近着手升级一个旧的 Symfony 4.4 应用程序(到 5.4 和 PHP 8.1)并且一直在关注 symfonycasts.com 上的精彩教程。 我已经到了我不明白如何前进的地步。 服务.yaml: .env.本地: TO_INJECT=astringgoeshere 当我尝试执行代码 ...
[英]Java - Proper Way To Initialize an Autowired Service
我继承了一个springboot应用。 此应用程序具有类似于以下内容的服务: , 此服务是从另一个类似于以下的服务自动装配的; ,最后,springboot app类似如下。 一旦 Kafka 主题有一条消息,就会调用 listen() 方法(Kafka 只在这里相关,因为它启动了自动装配服务的 ...
[英]JAVA - Can I delete @Autowire directly?
在我的队友合并她的更改后(为我们的 SpringBootApplication 实现 @EnableFeignClients 并从主分支创建一些假客户端、属性和配置),当启动应用程序时,它将弹出The dependencies of some of the beans in the applica ...
[英]Declaring beans inside a ConfigurationProperties class, using the same configuration property
我有一个名为UserData的 java class,它有一个名为users的字段,我正在通过使用@ConfigurationProperties注释从我的 spring-boot 应用application.yml中的 application.yml 读取它。 在这个 class 中,我想声明另 ...
[英]Java Spring: Autowire an implementation of an interface based on the value of a property in the same class
我有2节课 PricingStrategy是一个具有 1 个方法和 2 个实现的接口: 我想使用依赖注入根据 class VehicleType中vehicleType的值将PricingStrategyA或PricingStrategyB自动装配到Vehicle class 中。 在伪代码中: ...