我使用的是Spring Boot 3.0.0,Eclipse IDE 2022 - 12,Java语言级别/JDK 19。
文件pom.xml
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.0.0</version>
<relativePath/>
</parent>
<groupId>com.example</groupId>
<artifactId>spring_jwt</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>spring-boot-security-jwt</name>
<description>spring_jwt</description>
<properties>
<java.version>19</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-api</artifactId>
<version>0.11.5</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-impl</artifactId>
<version>0.11.5</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-jackson</artifactId>
<version>0.11.5</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-hibernate5-jakarta</artifactId>
<version>2.14.0</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.11.0</version>
</dependency>
<!-- Jasper report start. -->
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>6.20.0</version>
</dependency>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports-fonts</artifactId>
<version>6.20.0</version>
</dependency>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports-functions</artifactId>
<version>6.20.0</version>
</dependency>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports-metadata</artifactId>
<version>6.20.0</version>
</dependency>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports-chart-themes</artifactId>
<version>6.20.0</version>
</dependency>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports-annotation-processors</artifactId>
<version>6.20.0</version>
</dependency>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports-castor</artifactId>
<version>6.20.0</version>
</dependency>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>liberation-fonts</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports-chart-customizers</artifactId>
<version>6.20.0</version>
</dependency>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports-custom-visualization</artifactId>
<version>6.20.0</version>
</dependency>
<!-- Jasper report end. -->
<!-- https://mvnrepository.com/artifact/commons-beanutils/commons-beanutils -->
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.4</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.5.13.3</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-devtools</artifactId>-->
<!-- <scope>runtime</scope>-->
<!-- <optional>true</optional>-->
<!-- </dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.flywaydb</groupId>-->
<!-- <artifactId>flyway-core</artifactId>-->
<!-- <version>9.1.3</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>com.stimulsoft</groupId>-->
<!-- <artifactId>stimulsoft-reports-report</artifactId>-->
<!-- <version>2022.3.3</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>com.stimulsoft</groupId>-->
<!-- <artifactId>stimulsoft-reports-web</artifactId>-->
<!-- <version>2022.3.3</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>com.stimulsoft</groupId>-->
<!-- <artifactId>stimulsoft-reports-base</artifactId>-->
<!-- <version>2022.3.3</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>com.stimulsoft</groupId>-->
<!-- <artifactId>stimulsoft-reports-viewer</artifactId>-->
<!-- <version>2022.3.3</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>com.stimulsoft</groupId>-->
<!-- <artifactId>stimulsoft-reports-samples</artifactId>-->
<!-- <version>2022.3.3</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>com.stimulsoft</groupId>-->
<!-- <artifactId>stimulsoft-reports-webviewer</artifactId>-->
<!-- <version>2022.3.3</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>com.stimulsoft</groupId>-->
<!-- <artifactId>stimulsoft-reports-lib</artifactId>-->
<!-- <version>2022.3.3</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>com.stimulsoft</groupId>-->
<!-- <artifactId>stimulsoft-reports-webdesigner</artifactId>-->
<!-- <version>2022.3.3</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>com.stimulsoft</groupId>-->
<!-- <artifactId>reports</artifactId>-->
<!-- <version>2022.3.3</version>-->
<!-- <type>pom</type>-->
<!-- </dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>3.0.0</version>
</plugin>
<!-- <plugin>-->
<!-- <groupId>org.flywaydb</groupId>-->
<!-- <artifactId>flyway-maven-plugin</artifactId>-->
<!-- <version>9.1.3</version>-->
<!-- </plugin>-->
</plugins>
</build>
<repositories>
<repository>
<id>xpand</id>
<name>xpand</name>
<url>https://maven.xpand-it.com/artifactory/releases/</url>
</repository>
<repository>
<id>maven_central</id>
<name>maven_central</name>
<url>https://repo.maven.apache.org/maven2/</url>
</repository>
</repositories>
</project>
我有许多这样的控制器:文件UnitController.java
package com.example.controller;
import com.example.BLModel.Unit;
import com.example.BLModel.UnitId;
import com.example.service.UnitService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Optional;
@CrossOrigin(origins = "*", maxAge = 3600)
@RestController
@RequestMapping("/unit")
public class UnitController {
private static final Logger LOGGER = LoggerFactory.getLogger(UnitController.class);
@Autowired
UnitService unitService;
/**
* Get all units belong to a tenant_id .<br/>
* GET http://localhost:80/unit/1/all .
*
* @param tenant_id
* @return
*/
@GetMapping(value = "/{tenant_id}/all")
public ResponseEntity<List<Unit>> getAllUnits(@PathVariable("tenant_id") Short tenant_id) {
LOGGER.info("Call method getAllUnits() .");
return new ResponseEntity<>(unitService.getAll(tenant_id), HttpStatus.OK);
}
/**
* Get a unit by its composite primary key.<br/>
* GET http://localhost:80/unit/1/42 .
*
* @param tenant_id
* @param id
* @return
*/
@GetMapping(value = "/{tenant_id}/{id}")
public ResponseEntity<Unit> viewDetailUnit(@PathVariable("tenant_id") Short tenant_id,
@PathVariable("id") Short id) {
LOGGER.info("Call method viewDetailUnit() .");
UnitId unitId = new UnitId();
unitId.setId(id);
unitId.setTenantId(tenant_id);
Optional<Unit> unitOptional = unitService.getById(unitId);
Unit result = null;
if (unitOptional.isPresent()) {
result = unitOptional.get();
}
return new ResponseEntity<>(result, HttpStatus.OK);
}
/**
* Add a new unit.<br/>
* POST http://localhost:80/unit
*
* @param input
* @return
*/
@PostMapping()
public ResponseEntity<Unit> addUnit(@RequestBody Unit input) {
LOGGER.info("Call method addUnit() .");
Unit unit = new Unit();
unit.setUnitName(input.getUnitName());
unit.setDescription(input.getDescription());
unit.setActiveStatus(input.getActiveStatus());
Unit unitResult = unitService.add(unit);
return new ResponseEntity<>(unitResult, HttpStatus.OK);
}
/**
* Edit a unit.<br/>
* PATCH http://localhost:80/unit/1/42 .
*
* @param tenant_id
* @param id
* @param input
* @return
*/
@PatchMapping(value = "/{tenant_id}/{id}")
public ResponseEntity<Unit> editUnit(@PathVariable("tenant_id") Short tenant_id,
@PathVariable("id") Short id,
@RequestBody Unit input) {
LOGGER.info("Call method editUnit() .");
UnitId unitId = new UnitId();
unitId.setTenantId(tenant_id);
unitId.setId(id);
Unit unit = (unitService.getById(unitId)).get();
unit.setActiveStatus(input.getActiveStatus());
unit.setDescription(input.getDescription());
unit.setUnitName(input.getUnitName());
Unit unitResult = unitService.add(unit);
return new ResponseEntity<>(unitResult, HttpStatus.OK);
}
/**
* Delete a specific unit.<br/>
* DELETE http://localhost:80/unit/1/42 .
*
* @param tenant_id
* @param id
* @return
*/
@DeleteMapping(value = "/{tenant_id}/{id}")
public ResponseEntity<Object> deleteUnit(@PathVariable("tenant_id") Short tenant_id,
@PathVariable("id") Short id) {
UnitId unitId = new UnitId();
unitId.setId(id);
unitId.setTenantId(tenant_id);
unitService.delete(unitId);
return new ResponseEntity<>(null, HttpStatus.OK);
}
}
文件TimesheetSignController.java
一个二个一个一个
完整日志https://gist.github.com/donhuvy/45b15558e76164e83bdbc0117c9cf64f
如何避免/解决此警告?P/S:关于未重复问题的注解。在此问题和解答https://stackoverflow.com/a/74601911/3728901中,使用maven-compiler-plugin
,而不是spring-boot-maven-plugin
。
1条答案
按热度按时间i86rm4rw1#
这是一个已知的bug,there is a Spring Issue可以解决这个问题,但是它不会造成伤害,除非你不想在日志中出现警告,否则你不需要采取任何措施。
从问题:
“看起来核心bean工厂在构造函数自动装配算法期间不必要地检索构造函数参数名称,尽管没有指定构造函数参数名称。这是我们将在[Spring Framework] 6.0.3中修复的一个bug。”
以及
目前,您只需禁用org.springframework.core.LocalVariableTableParameterNameDiscoverer的警告日志类别即可。此时无需阅读类文件,但不会对应用程序造成任何损害。