![](/img/trans.png)
[英]What is the difference between @Entity and @Document in spring boot?
你能在你的數據庫表上同時使用這兩個注解嗎? id,就像對差異的一些澄清。 謝謝你 ...
[英]What is the difference between @Entity and @Document in spring boot?
你能在你的數據庫表上同時使用這兩個注解嗎? id,就像對差異的一些澄清。 謝謝你 ...
[英]Failure to parse configuration class
我正在嘗試構建一個之前在不同版本的 IntelliJ 中構建和運行的項目。 錯誤信息如下: 錯誤 osboot.SpringApplication - 應用程序運行失敗 org.springframework.beans.factory.BeanDefinitionStoreException:無 ...
[英]Does the spring boot annotation @Repository also automatically come with the @Transactional annotation too?
所以就在這里 ^ 例如,這個 spring 引導注釋 @Repository 是否也自動帶有 @Transactional 注釋? 還是我需要特別聲明@Transactional? 謝謝我不知道如何測試這個,也找不到任何相關文檔,所以我問堆棧溢出專家哈哈。 ...
[英]How to ignore field/column only when return response from spring boot
從 spring boot 返回響應時,我需要忽略該字段。 請找到以下信息, 我有一個名為 Student 的 pojo,如下所示 我正在為 PostRequest 獲取一個正文,如下所示 我想從 frontEnd (id,name,Lname) 獲取所有數據,但我只想返回沒有 id 的相同 poj ...
[英]In SpringBoot, how do I create a custom validator for a MultipartFile parameter?
賞金將在 6 天后到期。 此問題的答案有資格獲得+300聲望賞金。 Dave正在從可靠的來源尋找答案。 我正在使用 Spring Boot 2.4。 我有以下控制器,其方法接受 MultipartFile 對象。 我想驗證此 MultipartFile 是否包含我想要的數據(例如,屬於特定的 M ...
[英]Difference between @ConditionalOnClass , @ConditionalOnMissingClass
@ConditionalOnClass 和@ConditionalOnMissingClass 之間的區別? 有人可以告訴我這些注釋之間的區別嗎? ...
[英]SpringBoot 2.7.5 - @Value annotation not assigning any values from application.properties file
我正在使用 Spring Boot 2.7.5 在使用@Value注釋從application.properties文件注入值時,對@Configuration類下的變量進行空賦值。 例子: 在這里,我看到了對變量fileName的賦值。理想情況下,如果鍵不匹配,它應該賦值'${file.name} ...
[英]@Component with request scope attributes
我的 SpringBoot 項目中有一個 class @Component 。 這個Scope默認是singleton就可以了。 但是現在我需要一個 object,請求 scope,它將用於此組件 class 的許多方法中。唯一的方法是將此 object 作為所有方法中的參數傳遞? 或者,例如,我可 ...
[英]How to use @Query in Spring JPA?
我正在嘗試使用 @Query 注釋通過 spring(2.7.6) jpa 訪問類型為收入的費用。 數據庫截圖 postgresql 終端錯誤: 我正在嘗試在 ExpenseRepository 中執行; Model 看起來像這樣: 請幫我弄清楚如何執行此操作 ...
[英]CsvBindByPosition : value for annotation attribute must be a constant expression
我正在嘗試讀取一個 CSV 文件,其 header position 數字來自屬性文件。 我使用@Value 獲得字段的 position 編號。 但是,我無法將此值綁定為 @CsvBindByPosition 的@CsvBindByPosition 。 這是我的代碼: 這給了我這個錯誤: 注釋屬性 ...
[英]Spring Boot @Component annotation not used on interface but still bean is being provided with @Autowired
我是Spring Boot的新手。 據我所知,我們需要在 Spring 的類/接口上方使用@Component來將 bean 存儲在 Spring 容器中。 我們可以使用@Autowired注入那個 bean。 我一直在做一個演示項目,我在接口上看不到@Component但不知何故正確提供了該接口 ...
[英]Spring Annotation @CreatedBy and @CreatedByDate is not working but @LastModifiedBy and @LastModified date is working
我正在嘗試創建一個文檔 class,我在其中使用各自的注釋添加字段 creationTime、LastmodificationTime、createdBy 和 LastModifiedBy。 我看到的是帶有注釋 @CreatedBy 和 @CreatedDate 的 class 變量被填充為 nul ...
[英]Spring AOP - How to pass in a different number of parameters?
我有一個方面: 這是需要訪問相應業務 object 的方法: 本質上,我的問題是相應的業務 object 未被識別。 我知道你可以操縱和改變參數,但是你可以傳入額外的參數,還是只能改變它們? 如果我只能更改它們,我該怎么做才能調用此方法而無需傳入第二個參數? 為其中的每一個創建一個重載似乎有很多不 ...
[英]IntelliJ Passes the Full Import Path of an Annotation Above Class
有沒有人有過這樣的事情? @Service注解獲取到class上面的完整導入路徑,沒法修復。 我手動編寫了導入路徑,但 IntelliJ 無法識別它。 我知道這不是什么大事,只是為了展示目的。 謝謝... ...
[英]RestTemplate bean is not found in the service layer class even though i have autowired it
當我運行應用程序時它工作正常但是當我構建應用程序時它拋出這個異常 - 沒有可用類型'org.springframework.web.client.RestTemplate'的合格bean:預計至少有1個bean符合自動裝配候選資格。 下面是代碼片段請注意,我已經在主應用程序中創建了這個 bean,所 ...
[英]Create a validation method which throw MethodArgumentNotValidException
我正在嘗試驗證此 class: 像這樣使用 ObjectMapper 構建之后: 如您所見,我不能在這里使用@Valid注釋(注意:如果有直接使用注釋的方法,我會更喜歡它。但我沒有找到任何方法來做到這一點。 所以我發現最好創建一個驗證器 class 所以經過一些研究我發現了這個方法 但在他的構造函數 ...
[英]apply custom validation annotation to parameter
我有以下用於驗證密碼的類。 為 class 中的字段添加 @ValidPassword 注釋有效。 但是,當我嘗試將注釋添加到 function 中的參數時,永遠不會調用/訪問驗證器。 在此處添加注釋也不起作用: 我不認為我缺少任何依賴項,所以我不確定問題出在哪里。 ...
[英]Syntax error when using Spring @ConditionalOnExpression in Kotlin
我在 Kotlin 配置 class 中導入 org.springframework.boot.autoconfigure.condition.ConditionalOnExpression 但是當我在 bean 定義上使用帶有 Spring 表達式語言的注釋時,我收到錯誤消息An annotati ...
[英]How to implements entity with 2 entity as primary key with jpa annotation and repository
我想與其中的數量信息實現多對多關聯。 像這樣: GroupSanguin 和 Banque 是兩個 class 存儲在數據庫中的兩個。 如果需要,這是兩者的代碼: 所以我想知道如何注釋 JpaRepository 以將兩者作為主鍵,我的注釋是否適合它工作? ...
[英]Provide some value to @Valid annotation and using that value change validation in isValid() method
我在我的項目中使用兩個數據庫,並在驗證請求正文中提供的過濾器時,對於某些請求,我需要來自 db1 的驗證,而對於某些請求,我需要來自 db2 的驗證。 我在一個枚舉中映射了值及其對應的類型。 但是我如何確定必須為請求正文中提供的特定過濾器使用哪個映射。 下面是我的 controller 演示: 這需 ...