JSR commonly refers to Java Specification Requests, formal standards for the Java platform.
Questions tagged [jsr]
147 questions
9
votes
1 answer
How to validate 2 field with OR condition?
I want to validate two fields of a Request Class in manner that Either one field is valid OR another field is valid.
Eg:
Request Bean
public class CarRequest {
@NotEmpty
private String customerName;
@NotEmpty
private String…

praveen jain
- 778
- 2
- 8
- 23
9
votes
1 answer
"Turn off" bean validation programmatically (javax.validation.constraints)
For example, we have some entity in whitch several fields are validating with annotation @Pattern. This entity is used everywhere in project, but only in one place we need to "turn off" this validation.
Is there some way to do it programmatically or…

Mary Ryllo
- 2,321
- 7
- 34
- 53
8
votes
4 answers
How to implement a JSR Specification
I'm considering implementing one or two JSR APIs. I have not yet read the entire specification (the plan is to read them as I code the implementation) but I am very familiar with them. I have read that the JSR process includes implementing a Test…

pjesi
- 3,931
- 3
- 20
- 16
8
votes
2 answers
Compile Error: JSR/RET are not supported with computeFrames option
Getting this error on an IntelliJ project when I compile java files. There is no specific source file listed, but it fails with this error.
Removing the following compiler flags fixes the error:
-source 1.5 -target 1.5
However, these need to be in…

Sam Barnum
- 10,559
- 3
- 54
- 60
8
votes
2 answers
Validate only if the field is not Null
I use JSR303 Spring Validation and I have the following;
@Digits(fraction = 0, integer = 15)
private String tpMobile;
Validation says Must be number between 10-15 digits, but the thing is this field is optional. So when user left it empty also the…

Ravindu
- 2,408
- 8
- 30
- 46
7
votes
1 answer
How to validate @NotBlank for simple string parameter directly with javax?
I want to validate GET / POST request for spring-boot controller classes with the javax.validation-api annotations.
For classes @Valid and @NotBlank for attributes of that class work perfectly.
The following works as expected:
public class…

Spenhouet
- 6,556
- 12
- 51
- 76
6
votes
2 answers
JSR - 349 bean validation for Spring @RestController with Spring Boot
I am using Spring Boot 1.5.2.RELEASE and not able to incorporate JSR - 349 ( bean validation 1.1 ) for @RequestParam & @PathVariable at method itself.
For POST requests, if method parameter is a Java POJO then annotating that parameter with @Valid…

Sabir Khan
- 9,826
- 7
- 45
- 98
6
votes
1 answer
Hibernate validations on save (insert) only
We encountered a problem with legacy code. There is a validation set for a "username" field, validating its length and making sure it contains at least one letter:
@Column(name = "username")
@Size(min = 4, max = 40)
@Pattern(regexp =…

Tomer A
- 453
- 3
- 14
6
votes
1 answer
JSR 303 ConstraintViolationException and detailed message
I have configured my Spring Boot 1.5.1 application with JSR 303 validation. Right now I'm getting ConstraintViolationException in case of wrong data.
Is it possible to get a detailed message(now it is null) about what was wrong(for example what…

alexanoid
- 24,051
- 54
- 210
- 410
6
votes
1 answer
How to Proguard two android project?
I have developed two projects in Andriod system based on java A and B , the codes in project A rely on codes in project B ,also the codes in project B rely on codes in project A.Can I use Proguard obfuscate A but not obfuscate B, A and B can…

user1828727
- 123
- 5
5
votes
3 answers
How to specify character encoding for h2 in memory database scripts?
I have troubles with character encoding in my JPA test class.
In my h2 in memory database I have this insert query :
INSERT INTO MYTABLE (ID,FIELD1,FIELD2) VALUES (100,'ABC','Réclamation');
(please notice the "é" character in "Réclamation")
In my…

Sinda MOKADDEM
- 796
- 2
- 12
- 35
5
votes
2 answers
What are some implementations of JSR 352 (Java for batch)?
Can we say Spring Batch is an implementation of the JSR 352 (spec for Batch Applications for the Java Platform) ?
What are some other implementations of JSR 352 ?

yathirigan
- 5,619
- 22
- 66
- 104
5
votes
6 answers
What does the jsr keyword mean?
I'm looking at some Java code, and I've noticed the following:
if (!foo(bar, baz, qux)) {
i = 0; jsr 433;
}
javac chokes on it, saying it's not a statement and that a semicolon is expected after the keyword jsr.
I did some Googling, and I found…
user113292
5
votes
1 answer
Spring Validation - NULL or valid url
In my Spring Boot application I have a following method:
Decision create(@NotBlank String name, String url, @NotNull User author);
Right now directly in the code I'm checking a following condition:
if…

alexanoid
- 24,051
- 54
- 210
- 410
5
votes
0 answers
How to set FieldError field in a custom jsr 303 validation
I am creating a webservice in spring. I have a Params DTO which is nested in my OtherParentDTO's. Each request may contain only certain fields in the params Dto.
If the fields are present then I need to do a validation(basically null check). In the…

blackhorse
- 51
- 4