cost 162 ms
spring 引导注释@Repository 是否也自动带有@Transactional 注释? - Does the spring boot annotation @Repository also automatically come with the @Transactional annotation too?

所以就在这里 ^ 例如,这个 spring 引导注释 @Repository 是否也自动带有 @Transactional 注释? 还是我需要特别声明@Transactional? 谢谢我不知道如何测试这个,也找不到任何相关文档,所以我问堆栈溢出专家哈哈。 ...

如何仅在从 spring boot 返回响应时忽略字段/列 - How to ignore field/column only when return response from spring boot

从 spring boot 返回响应时,我需要忽略该字段。 请找到以下信息, 我有一个名为 Student 的 pojo,如下所示 我正在为 PostRequest 获取一个正文,如下所示 我想从 frontEnd (id,name,Lname) 获取所有数据,但我只想返回没有 id 的相同 poj ...

在 SpringBoot 中,如何为 MultipartFile 参数创建自定义验证器? - In SpringBoot, how do I create a custom validator for a MultipartFile parameter?

赏金将在 6 天后到期。 此问题的答案有资格获得+300声望赏金。 Dave正在从可靠的来源寻找答案。 我正在使用 Spring Boot 2.4。 我有以下控制器,其方法接受 MultipartFile 对象。 我想验证此 MultipartFile 是否包含我想要的数据(例如,属于特定的 M ...

SpringBoot 2.7.5 - @Value 注释不从 application.properties 文件分配任何值 - 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} ...

CsvBindByPosition:注释属性的值必须是常量表达式 - CsvBindByPosition : value for annotation attribute must be a constant expression

我正在尝试读取一个 CSV 文件,其 header position 数字来自属性文件。 我使用@Value 获得字段的 position 编号。 但是,我无法将此值绑定为 @CsvBindByPosition 的@CsvBindByPosition 。 这是我的代码: 这给了我这个错误: 注释属性 ...

Spring Boot @Component 注释未在接口上使用,但仍由 @Autowired 提供 bean - 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 注释@CreatedBy 和@CreatedByDate 不工作但@LastModifiedBy 和@LastModified 日期工作 - 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 - 如何传入不同数量的参数? - Spring AOP - How to pass in a different number of parameters?

我有一个方面: 这是需要访问相应业务 object 的方法: 本质上,我的问题是相应的业务 object 未被识别。 我知道你可以操纵和改变参数,但是你可以传入额外的参数,还是只能改变它们? 如果我只能更改它们,我该怎么做才能调用此方法而无需传入第二个参数? 为其中的每一个创建一个重载似乎有很多不 ...

在服务层 class 中找不到 RestTemplate bean,即使我已经自动装配了它 - 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,所 ...

创建一个抛出 MethodArgumentNotValidException 的验证方法 - Create a validation method which throw MethodArgumentNotValidException

我正在尝试验证此 class: 像这样使用 ObjectMapper 构建之后: 如您所见,我不能在这里使用@Valid注释(注意:如果有直接使用注释的方法,我会更喜欢它。但我没有找到任何方法来做到这一点。 所以我发现最好创建一个验证器 class 所以经过一些研究我发现了这个方法 但在他的构造函数 ...

将自定义验证注释应用于参数 - apply custom validation annotation to parameter

我有以下用于验证密码的类。 为 class 中的字段添加 @ValidPassword 注释有效。 但是,当我尝试将注释添加到 function 中的参数时,永远不会调用/访问验证器。 在此处添加注释也不起作用: 我不认为我缺少任何依赖项,所以我不确定问题出在哪里。 ...

如何使用 jpa 注释和存储库实现具有 2 个实体作为主键的实体 - How to implements entity with 2 entity as primary key with jpa annotation and repository

我想与其中的数量信息实现多对多关联。 像这样: GroupSanguin 和 Banque 是两个 class 存储在数据库中的两个。 如果需要,这是两者的代码: 所以我想知道如何注释 JpaRepository 以将两者作为主键,我的注释是否适合它工作? ...

为 @Valid 注释提供一些值,并在 isValid() 方法中使用该值更改验证 - Provide some value to @Valid annotation and using that value change validation in isValid() method

我在我的项目中使用两个数据库,并在验证请求正文中提供的过滤器时,对于某些请求,我需要来自 db1 的验证,而对于某些请求,我需要来自 db2 的验证。 我在一个枚举中映射了值及其对应的类型。 但是我如何确定必须为请求正文中提供的特定过滤器使用哪个映射。 下面是我的 controller 演示: 这需 ...


 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM