I am using Spring Boot 3.0.0, Eclipse IDE 2022-12, Java language level/JDK 19.
File 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>
I have many controllers like these: File 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);
}
}
File TimesheetSignController.java
package com.example.controller;
import com.example.BLModel.TimesheetSign;
import com.example.BLModel.TimesheetSignId;
import com.example.service.TimesheetSignService;
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("/timesheet_sign")
public class TimesheetSignController {
private static final Logger LOGGER = LoggerFactory.getLogger(TimesheetSignController.class);
@Autowired
TimesheetSignService timesheetSignService;
/**
* Get all time_sheet_sign by its tenant_id .<br/>
* GET http://localhost:80/time_sheet_sign/1/all .
*
* @param tenant_id
* @return
*/
@GetMapping(value = "/{tenant_id}")
public ResponseEntity<List<TimesheetSign>> getAllAccounts(@PathVariable("tenant_id") Short tenant_id) {
LOGGER.info("Call method getAllAccounts() .");
return new ResponseEntity<>(timesheetSignService.getAll(tenant_id), HttpStatus.OK);
}
/**
* Get a specific time_sheet_sign item by its composite primary key.
* GET http://localhost:80/1/42
*
* @param tenant_id
* @param id
* @return
*/
@GetMapping(value = "/{tenant_id}/{id}")
public ResponseEntity<TimesheetSign> viewDetailAccount(@PathVariable("tenant_id") Short tenant_id,
@PathVariable("id") Short id) {
LOGGER.info("Call method viewDetailAccount() .");
TimesheetSignId timesheetSignId = new TimesheetSignId();
timesheetSignId.setId(id);
timesheetSignId.setTenantId(tenant_id);
Optional<TimesheetSign> timesheetSignOptional = timesheetSignService.getById(timesheetSignId);
TimesheetSign timesheetSignResult = null;
if (timesheetSignOptional.isPresent()) {
timesheetSignResult = timesheetSignOptional.get();
}
return new ResponseEntity<>(timesheetSignResult, HttpStatus.OK);
}
/**
* Create a new time_sheet_sign .<br/>
* POST http://localhost:80/time_sheet_sign
*
* @param input
* @return
*/
@PostMapping()
public ResponseEntity<TimesheetSign> addAccount(@RequestBody TimesheetSign input) {
LOGGER.info("Call method addAccount() .");
TimesheetSign timesheetSign = new TimesheetSign();
timesheetSign.setTimesheetSignCode(input.getTimesheetSignCode());
timesheetSign.setActiveStatus(input.getActiveStatus());
timesheetSign.setIsDefault(input.getIsDefault());
timesheetSign.setIsSystem(input.getIsSystem());
timesheetSign.setIsHalfDay(input.getIsHalfDay());
TimesheetSign timesheetSignResult = timesheetSignService.add(timesheetSign);
return new ResponseEntity<>(timesheetSignResult, HttpStatus.OK);
}
/**
* Edit time_sheet_sign by its composite primary key.
* PATCH http://localhost:80/time_sheet_sign/1/42 .
*
* @param tenant_id
* @param id
* @param input
* @return
*/
@PatchMapping(value = "/{tenant_id}/{id}")
public ResponseEntity<TimesheetSign> editAccount(@PathVariable("tenant_id") Short tenant_id,
@PathVariable("id") Short id,
@RequestBody TimesheetSign input) {
LOGGER.info("Call method editAccount() .");
TimesheetSignId timesheetSignId = new TimesheetSignId();
timesheetSignId.setTenantId(tenant_id);
timesheetSignId.setId(id);
TimesheetSign timesheetSign = (timesheetSignService.getById(timesheetSignId)).get();
timesheetSign.setTimesheetSignName(input.getTimesheetSignName());
timesheetSign.setIsHalfDay(input.getIsHalfDay());
timesheetSign.setIsSystem(input.getIsSystem());
timesheetSign.setTimesheetSignCode(input.getTimesheetSignCode());
timesheetSign.setSalaryRate(input.getSalaryRate());
TimesheetSign timesheetSignResult = timesheetSignService.add(timesheetSign);
return new ResponseEntity<>(timesheetSignResult, HttpStatus.OK);
}
/**
* Delete time_sheet_sign by its composite primary key.
* DELETE http://localhost:80/time_sheet_sign/1/42 .
*
* @param tenant_id
* @param id
* @return
*/
@DeleteMapping(value = "/{tenant_id}/{id}")
public ResponseEntity<Object> deleteAccount(@PathVariable("tenant_id") Short tenant_id,
@PathVariable("id") Short id) {
TimesheetSignId timesheetSignId = new TimesheetSignId();
timesheetSignId.setId(id);
timesheetSignId.setTenantId(tenant_id);
timesheetSignService.delete(timesheetSignId);
return new ResponseEntity<>(null, HttpStatus.OK);
}
}
[2m2022-12-19T08:18:19.517+07:00[0;39m [32m INFO[0;39m [35m7048[0;39m [2m---[0;39m [2m[nio-8082-exec-1][0;39m [36mo.s.web.servlet.DispatcherServlet [0;39m [2m:[0;39m Initializing Servlet 'dispatcherServlet'
[2m2022-12-19T08:18:19.520+07:00[0;39m [32m INFO[0;39m [35m7048[0;39m [2m---[0;39m [2m[nio-8082-exec-1][0;39m [36mo.s.web.servlet.DispatcherServlet [0;39m [2m:[0;39m Completed initialization in 3 ms
[2m2022-12-19T08:18:21.177+07:00[0;39m [33m WARN[0;39m [35m7048[0;39m [2m---[0;39m [2m[nio-8082-exec-8][0;39m [36mocalVariableTableParameterNameDiscoverer[0;39m [2m:[0;39m Using deprecated '-debug' fallback for parameter name resolution. Compile the affected code with '-parameters' instead or avoid its introspection: com.example.controller.UnitController
[2m2022-12-19T08:18:21.313+07:00[0;39m [33m WARN[0;39m [35m7048[0;39m [2m---[0;39m [2m[nio-8082-exec-8][0;39m [36mocalVariableTableParameterNameDiscoverer[0;39m [2m:[0;39m Using deprecated '-debug' fallback for parameter name resolution. Compile the affected code with '-parameters' instead or avoid its introspection: com.example.controller.TimesheetSignController
[2m2022-12-19T08:18:21.331+07:00[0;39m [33m WARN[0;39m [35m7048[0;39m [2m---[0;39m [2m[nio-8082-exec-8][0;39m [36mocalVariableTableParameterNameDiscoverer[0;39m [2m:[0;39m Using deprecated '-debug' fallback for parameter name resolution. Compile the affected code with '-parameters' instead or avoid its introspection: com.example.controller.TaxAgentInfoController
Full log https://gist.github.com/donhuvy/45b15558e76164e83bdbc0117c9cf64f
How to avoid/resolve this warning?
P/S: Comment about not dupplicated question. In this question and solution https://stackoverflow.com/a/74601911/3728901 , use maven-compiler-plugin
, not spring-boot-maven-plugin
.
I'm using spring-context version 6.0.11 and the problem still exists.
Add this build plugin to the pom.xml file of your project:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgs>
<arg>-parameters</arg>
</compilerArgs>
</configuration>
</plugin>
</plugins>
</build>
If you already have this plugin in your pom.xml file then just add configuration part to the existing Maven compiler plugin:
<configuration>
<compilerArgs>
<arg>-parameters</arg>
</compilerArgs>
</configuration>
Apache Maven Compiler Plugin is used to compile the sources of your Maven project.
When you specify this plugin in your project you can add configuration to it:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
...
</configuration>
</plugin>
For example, if you want to use the Java 8 language features (-source 1.8
) and also want the compiled classes to be compatible with JVM 1.8 (-target 1.8
), you can either add the two following configuration:
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
Another configuration we can specify is passing arguments to the Java compiler (javac):
<configuration>
<compilerArgs>
<arg>-parameters</arg>
</compilerArgs>
</configuration>
We passed -parameters
as an additional argument to the compiler.
And of course both preceding configurations can be used together.
This is a known bug and there is a Spring Issue for it. But it is not harmful and you do not need to take any action unless you just don't want warnings in your logs.
From the issue:
It looks like the core bean factory is unnecessarily retrieving constructor parameter names during the constructor autowiring algorithm, despite no constructor argument names having been specified. That's a bug we're going to fix in [Spring Framework] 6.0.3."
and
For the time being, you may simply disable the warn log category for
org.springframework.core.LocalVariableTableParameterNameDiscoverer
. There is unnecessary reading of class files in the meantime but otherwise no harm for your application.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With