thymeleaf : EL1050E The arguments (...) for the constructor call are missing

本文介绍了一段包含Java关键字'new'作为变量名而导致的代码错误,并给出了修改后的解决方案。通过将变量名从'new'更改为'news',成功避免了语法冲突。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<a href="list.html" th:href="${#strings.replace(new.href,'{page}',1)}" >MORE+</a>

这段代码执行时会发生错误,如题。

原因在于:new.href 使用java 的关键字,把new改成news后就不再报错。

转载于:https://www.cnblogs.com/huiy/p/7701015.html

### 解决 Maven 项目中 `spring-boot-starter-thymeleaf` 依赖版本为空的问题 当遇到 `Cannot resolve org.springframework.boot:spring-boot-starter-thymeleaf:2.7.5-SNAPSHOT` 的错误提示时,这通常意味着 Maven 无法找到指定版本的依赖项[^1]。 #### 使用 Spring Boot 版本管理功能 Spring Boot 提供了一个强大的依赖管理和版本控制机制。通过继承 Spring Boot 父 POM 或者导入 BOM(Bill of Materials),可以自动管理所有 Spring Boot 相关依赖的版本号。因此,在大多数情况下不需要显式声明依赖的具体版本号。 ```xml <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>3.0.0</version> <!-- 这里填写所需的稳定版 --> <relativePath/> <!-- lookup parent from repository --> </parent> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> </dependencies> ``` 上述配置会自动应用最新稳定的 Thymeleaf 和其他组件版本到项目中[^2]。 #### 配置仓库地址 如果确实需要使用 SNAPSHOT 版本,则应确保本地或远程仓库已正确配置以支持这些预发布版本。默认情况下,Maven 只会在中央库查找正式发布的构件。对于快照版本,需添加额外的镜像源: ```xml <repositories> <repository> <id>spring-snapshots</id> <name>Spring Snapshots</name> <url>https://repo.spring.io/snapshot</url> <snapshots><enabled>true</enabled></snapshots> </repository> <repository> <id>spring-milestones</id> <name>Spring Milestones</name> <url>https://repo.spring.io/milestone</url> <snapshots><enabled>false</enabled></snapshots> </repository> </repositories> ``` 这样就可以成功解析并下载 `-SNAPSHOT` 后缀的开发构建版本了。 #### 更新本地缓存 有时由于网络原因或其他因素可能导致某些资源未能及时更新至本地存储。此时可以通过命令行强制刷新索引文件来解决问题: ```bash mvn clean install -U ``` 此操作将会清理旧数据重新同步最新的元数据信息给当前工程环境。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值