[
https://issues.apache.org/jira/browse/SHIRO-873?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
wu updated SHIRO-873:
---------------------
Description:
Integration spring-boot-starter-web 2.6.5 and spring-boot-starter-validation
2.6.5
use "authc" filter.
{code:java}
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.validation.annotation.Validated;
import javax.validation.constraints.Min;
@RestController
@RequestMapping("/test")
@Validated
public class TestController {
@PostMapping("/test")
public String test(@RequestParam @Min(10) Integer i){
return "test";
}
}
{code}
When annotation @Validated on TestController, link "/test/test" is return to
"404 not found"
If don't ues annotation @Validated, link mapping is right, but annotation
@Min(10) to validate is not work.
if use '@RequestBody' and '@Validated' on method parameter , it's worked..
like this
{code:java}
public class User{
@Min(10)
Integer id;
}
@RestController
@RequestMapping("/test1")
public class Test1Controller{
@PostMapping("/test1")
public String test1(@Request @Validated User user) {
return "test1"
}
}
{code}
please check it, thanks.
was:
Integration spring-boot-starter-web 2.6.5 and spring-boot-starter-validation
2.6.5
use "authc" filter.
{code:java}
@RestController
@RequestMapping("/test")
@Validated
public class TestController {
@PostMapping("/test")
public String test(@RequestParam @Min(10) Integer i){
return "test";
}
}
{code}
When annotation @Validated on TestController, link "/test/test" is return to
"404 not found"
If don't ues annotation @Validated, link mapping is right, but annotation
@Min(10) to validate is not work.
if use '@RequestBody' and '@Validated' on method parameter , it's worked..
like this
{code:java}
public class User{
@Min(10)
Integer id;
}
@RestController
@RequestMapping("/test1")
public class Test1Controller{
@PostMapping("/test1")
public String test1(@Request @Validated User user) {
return "test1"
}
}
{code}
please check it, thanks.
> Return to "404 not found" when controller uses annotation "@Validated".
> -----------------------------------------------------------------------
>
> Key: SHIRO-873
> URL: https://issues.apache.org/jira/browse/SHIRO-873
> Project: Shiro
> Issue Type: Bug
> Components: Integration: Spring
> Affects Versions: 1.9.0
> Environment: OS: macos12.3
> JDK: openjdk version "17.0.2" 2022-01-18 LTS
> spring-boot-starter-web: 2.6.5
> spring-boot-starter-validation: 2.6.5
> shiro: 1.9.0
> Reporter: wu
> Assignee: Les Hazlewood
> Priority: Major
>
> Integration spring-boot-starter-web 2.6.5 and spring-boot-starter-validation
> 2.6.5
>
> use "authc" filter.
>
>
> {code:java}
> import org.springframework.web.bind.annotation.RestController;
> import org.springframework.web.bind.annotation.RequestMapping;
> import org.springframework.validation.annotation.Validated;
> import javax.validation.constraints.Min;
> @RestController
> @RequestMapping("/test")
> @Validated
> public class TestController {
> @PostMapping("/test")
> public String test(@RequestParam @Min(10) Integer i){
> return "test";
> }
> }
> {code}
>
>
> When annotation @Validated on TestController, link "/test/test" is return to
> "404 not found"
> If don't ues annotation @Validated, link mapping is right, but annotation
> @Min(10) to validate is not work.
>
> if use '@RequestBody' and '@Validated' on method parameter , it's
> worked.. like this
>
>
> {code:java}
>
> public class User{
> @Min(10)
> Integer id;
> }
>
> @RestController
> @RequestMapping("/test1")
> public class Test1Controller{
> @PostMapping("/test1")
> public String test1(@Request @Validated User user) {
> return "test1"
> }
> }
>
> {code}
> please check it, thanks.
>
--
This message was sent by Atlassian Jira
(v8.20.1#820001)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]