spring 相关问题

Spring Framework是Java平台上应用程序开发的开源框架。其核心是对基于组件的体系结构的丰富支持,目前它拥有20多个高度集成的模块。

无法确定响应目的地:请求消息不包含回复目的地,

有人可以帮助我吗? 我在控制台中出现此错误:jakarta.jms.InvalidDestinationException:无法确定响应目的地:请求消息不包含回复目的地,a...

回答 1 投票 0

Spring RestTemplate 动态 JSON 属性名称

我需要使用一个使用 Spring RestTemplate 返回对象页面的 API。问题在于保存对象集合的 JSON 页面属性的名称是动态的。我怎样才能...

回答 2 投票 0

IoC和AOP是什么关系?

我正在这个网站上阅读 spring 文档。 我已经了解了一些 IoC(或 DI)和 AOP 知识。 在阅读文档时,我读到了这句话。 其中最重要的是 Spring 框架的 Inver...

回答 4 投票 0

在 Java Web 应用程序中实现 JSON Web 令牌 (JWT) 身份验证

jwt 类 包 com.inn.billing.com.inn.billing.JWT; 导入 java.util.function.Function; 导入 io.jsonwebtoken.Claims; 公共类 JwtUtil { 私有字符串秘密=“”; 酒吧...

回答 1 投票 0

tomcat9服务器重启是不是内存泄漏导致的?

我在我的应用程序日志中发现表明内存泄漏。同时我的系统重新启动是否是内存泄漏的原因。 应用日志 2024 年 5 月 16 日 01:00:57.374 警告 [Thread-4] org.apache.catal...

回答 1 投票 0

启动Spring Boot应用程序时出现bean创建错误

当我尝试运行我的 Spring Boot 应用程序时,我收到此异常: org.springframework.beans.factory.BeanCreationException:错误 创建名为“configurationPropertiesBeans”的 bean 定义于 ...

回答 10 投票 0

使用Spring Boot调用过程

尝试用html从oracle调用过程到spring 这是程序: 创建或替换过程 SEARCH_PERSON( I_NATIONALITY_NUMBER IN VAR...

回答 1 投票 0

Spring AI - 在 spring.ai.vertex.ai.gemini.credentialsUri 中使用 json 文件时身份验证失败

我尝试在 Spring Boot 应用程序中使用 VertexAIGeminiChat 模块,但是当我在凭据Uri 中使用服务帐户 json 文件时,出现此错误: UNAUTHENTICATED:请求的身份验证无效

回答 1 投票 0

JPA/Hibernate:即使我使用@Inheritance(strategy = InheritanceType.JOINED)也没有创建外键

我有一个超级抽象类User: 包 com.Abdelouadoud.MoroccoCraftsAPI.model.User; 导入 com.Abdelouadoud.MoroccoCraftsAPI.model.Adress; 导入 com.Abdelouadoud.MoroccoCraftsAPI.model.User...

回答 1 投票 0

@ServiceActivator(inputChannel = "[topic].[group].errors") 注释会导致“是否存在无法解析的循环引用异常?”

使用处理本地异常的通道时发生异常,但工作正常。 @ServiceActivator(inputChannel = "force-logout-topic.force-logout-group.errors") 公共空间

回答 1 投票 0

如何在多个eureka服务器上注册一个微服务?如果可以的话可以怎么做

尤里卡: 客户: 服务网址: 默认区域:http://localhost:8761/eureka/,http://localhost:8762/eureka 实例: 首选 IP 地址:true 管理: 端点: 网址: 接触: 包括: ”*” 我...

回答 1 投票 0

JPA save() 涉及@UniqueContraint 字段

我在 Spring 项目中使用 JPA 和 Hibernate 实现。 这些实体如下: @Table(uniqueConstraints={@UniqueConstraint(columnNames = {"通道", "开始", "结束"})}) @实体(呐...

回答 1 投票 0

带有 thymeleaf 的 Spring boot 不起作用

POM 聚甲醛 <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>test</groupId> <artifactId>test</artifactId> <version>1.0-SNAPSHOT</version> <packaging>jar</packaging> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.2.6.RELEASE</version> </parent> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project> 申请 @SpringBootApplication public class Application { public static void main(String args[]){ SpringApplication.run(Application.class); } } 控制器 @Controller @RequestMapping("/index") public class IndexController { @RequestMapping("/") String index(){ return "index"; } } 我在资源文件夹和 error.html 和 index.html 中也有 templates 文件夹 当我访问 localhost:8080/index 时,显示错误而不是索引。我究竟做错了什么?这确实是最简单的设置,但它已经错了...... 问题出在你的IndexController课程上。按照您声明的方式,您可以通过 : http://localhost:8080/index/ 访问您的页面,但不能通过 localhost:8080/index url 访问您的页面。这就是为什么你的方法上有类注释 @RequestMapping 和相同的注释。 url 构造是某种层次结构 - 首先是 spring 检查类注释,然后是方法注释和构建的请求映射处理程序是: host + port + "index" + "/" 。 我又提出了一个潜在的问题。就我而言,直到 index.html 位于“static”文件夹中时它才起作用。当我将文件移动到“模板”文件夹时它起作用了。

回答 2 投票 0

@ResponseStatus Spring 注解对于 RESTful 应用程序到底如何工作?

我正在学习Spring Core认证,我对Spring如何处理REST请求有一些疑问。 我知道通过 REST,资源会以名称的形式公开,并且对这些资源的操作

回答 1 投票 0

如何在Jhipster 8.4.0(account.model)中获取用户Id不在类中显示id但在控制台中显示

我在我的角度项目中使用 Jhipster 8.4.0 我无法获取登录帐户的用户的 ID,无法使用该 ID 进行搜索。 使用: ngOnInit() { this.primengConfig.ripple = true; 这个。

回答 1 投票 0

Spring 控制器测试随机失败

有一个项目大约有20个控制器。每个控制器都有其对应的测试类。 当我们尝试添加新的控制器测试类时,之前正在运行的一些测试

回答 1 投票 0

为什么Spring中找不到JSP?文件存在

在一个非常基本的应用程序中,我有 sayHelloController.java 如下 @控制器 公共类 SayHelloController { @RequestMapping(“说你好-jsp”) 公共字符串 sayHelloJsp() { ...

回答 3 投票 0

我可以将不同的 Spring 5.x 版本升级到单个 6.x 版本吗?

我想将 Wildfly 28 的 spring 版本升级到 6.1.0,但我在应用程序 pom.xml 中发现,我看到不同版本的 spring 相关 jar(例如 5.3.20、5.2.2、2.3.2)。 ....),如下所示...

回答 1 投票 0

使用 MockMvc 测试发送带有文件的对象

我想将一个对象发送到控制器,该对象具有多个包含文件的列表和多个包含纯文本的字段。 公共类贡献新 { 私人名单 我想将一个对象发送到控制器,该对象具有多个包含文件的列表和多个包含纯文本的字段。 public class ContributionNew<T extends MovieInfoDTO> { private List<T> elementsToAdd; private Map<Long, T> elementsToUpdate; private Set<Long> idsToDelete; private Set<String> sources; private String comment; } public class Photo extends MovieInfoDTO { private MultipartFile photo; } @PostMapping(value = "/{id}/contributions/photos") @ResponseStatus(HttpStatus.CREATED) public ResponseEntity<Void> createPhotoContribution( @ApiParam(value = "The movie ID", required = true) @PathVariable("id") final Long id, @ApiParam(value = "The contribution", required = true) @RequestBody @Valid final ContributionNew<Photo> contribution ) { 我想创建一个测试来发送对象,但我不知道如何完成它。 @Test public void testCreatePhotoContribution() throws Exception { ContributionNew<Photo> contribution = new ContributionNew<>(); MockMultipartFile multipartFile = new MockMultipartFile("photo", "C:\\Users\\Jonatan\\Pictures\\2.png", "image/png", "Spring Framework".getBytes()); Photo.Builder photoBuilder = new Photo.Builder( multipartFile ); contribution.getElementsToAdd().add(photoBuilder.build()); mockMvc .perform(post("/api/v1.0/movies/{id}/contributions/photos", 1) .contentType(...) .content(...)) .andExpect(status().isCreated()); } 我不知道如何为传输的数据设置正确的类型,设置内容。仅有关仅发送文件(不在对象中)的教程可用。但没有指南表明文件是对象中的字段之一。怎么办? 对于那些想知道的人: 您可以发送 MultipartFile 和一些纯文本字段,以映射到控制器中的 1 个对象。看看我的例子。 达: public class NewFileInfoDto { @NotNull @Positive() private Long requestId; @NotNull private MultipartFile file; } 控制器: @PostMapping @ResponseStatus(HttpStatus.CREATED) public FileInfoDto addFile(@ModelAttribute @Valid NewFileInfoDto dto) { return fileService.addFile(dto); } 测试部分: mockMvc.perform(multipart("/file") .file(file) .param("requestId", "3") .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isCreated()); ```

回答 1 投票 0

如何从数据库获取图像到itext7中的< Image>?

在我的invoiceGenerator中,我需要获取发票中的图像,该图像作为字节[]存储在postgres数据库中 因为我将此图像输入从方法中硬编码的本地路径更改为实体 ImageDa...

回答 1 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.