[英]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 中。 在偽代碼中: ...