jsr305

Is it possible to combine spring boot @Value with javax.validation.constraints?

牧云@^-^@ 提交于 2020-06-16 03:18:06
问题 I would like to validate values in application.properties . I use @Value to inject and @NotBlank to validate the method parameter in a class annotated with @Configuration . createSslContext( @Value("#{systemProperties['javax.net.ssl.trustStore']}") @NotBlank(message = "Truststore is needed") String path) I have included the hibernate-validator and the hibernate-validator-annotation-processor properties. Using Spring 2.2.0.RELEASE. It doesn't work. The value is injected, but not validated.

What is the status of JSR 305?

一曲冷凌霜 提交于 2019-12-28 08:06:09
问题 I have seen the question JSR305 vs. JSR308 (Java Type Anotations) - Which is going to be the standard? and I understand the difference between JSR 308 and JSR 305. I also understand that, at this time, 308 is slated for Java 7, and 305 is not, and I am curious about the overall status of 305. Specifically, I am using Google Collections and JSR-305 in some of my projects (in a similar manner to what one of the Guice best practices advocates) and was wondering if there is a more "future

Why do I need adding artifact JSR305 to use Guava 14+?

≯℡__Kan透↙ 提交于 2019-12-23 10:08:14
问题 While looking for informations on stackoverflow, I have seen a question similar to mine, but with no real answer here. I need migrating my maven project from guava 11.0.2 to guava 14 or higher (I need RangeSet). I updated my maven pom with the dependency: <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>14.0</version> </dependency> I then run the maven build, and got this error: [ERROR] xxx.java: cannot find symbol [ERROR] symbol : class Nonnull [ERROR]

Findbugs using jsr305 annotations in eclipse is not finding bugs

谁都会走 提交于 2019-12-12 15:08:58
问题 I've been experimenting with the jsr 305 annotations for use with Findbugs, specifically the @CheckForNull annotation which would have avoided a bug I just found making it out to customers. I've added jsr305.jar and annotations.jar to my build path but the bugs aren't found by findbugs. I'm using Eclipse with the Eclipse Findbugs plugin. Below is some sample code which shows the same bug but doesn't when I run findbugs over it find the bug. I have tried this in Eclipse Galileo and Ganymede.

Is @ParametersAreNonnullByDefault applies to method return values too?

风流意气都作罢 提交于 2019-12-10 04:04:37
问题 The documentation for @ParametersAreNonnullByDefault says, that: This annotation can be applied to a package, class or method to indicate that the method parameters in that element are nonnull by default unless ... I don't consider a method's return type/value to be it's parameter. It is only part of its signature, so this is kind of ambiguous for me. The Java tutorial for methods seems to think like me. As Joachim Sauer pointed out for me in the comments section of his answer, the name

JSR305 vs. JSR308 (Java Type Anotations) - Which is going to be the standard?

只愿长相守 提交于 2019-12-09 04:37:42
问题 There seem to be two different JSRs for annotations. JSR-305: Annotations for Software Defect Detection (additional resource) JSR-308: Annotations on Java Types (additional resource) Both seem to be oriented towards static code analysis. Do you know: which of the both is going to be either in Java SE 7 or Java EE 6? how "stable" is each JSR? does the one supersedes (or obsoletes) the other? 回答1: I can answer your last question. They are not the same thing. 305 is about new annotations where

Is there a good Eclipse plugin for checking @Nonnull and @Nullable annotations?

百般思念 提交于 2019-12-07 09:58:42
问题 The checking of the @Nonnull and @Nullable annotations in Eclipse is an early beta. The largest problem is that there it no knowing over the null behavior of the Java API. Are there any other plugins that are better currently? 回答1: It's now integrated in Eclipse Kepler. 回答2: I have found that FindBugs works well and is easy to use. FindBugs Plugin 回答3: Get Eclipse SDK 3.7(or Indigo) Enter this update URL: http://download.eclipse.org/objectteams/updates/contrib Select and install : JDT Null

Is there a good Eclipse plugin for checking @Nonnull and @Nullable annotations?

本秂侑毒 提交于 2019-12-05 13:23:21
The checking of the @Nonnull and @Nullable annotations in Eclipse is an early beta . The largest problem is that there it no knowing over the null behavior of the Java API. Are there any other plugins that are better currently? It's now integrated in Eclipse Kepler. I have found that FindBugs works well and is easy to use. FindBugs Plugin Get Eclipse SDK 3.7(or Indigo) Enter this update URL: http://download.eclipse.org/objectteams/updates/contrib Select and install : JDT Null Annotation Checker (Early Access) Object Teams Equinox Integration The largest problem is that there it no knowing over

Is @ParametersAreNonnullByDefault applies to method return values too?

一曲冷凌霜 提交于 2019-12-05 06:05:11
The documentation for @ParametersAreNonnullByDefault says, that: This annotation can be applied to a package, class or method to indicate that the method parameters in that element are nonnull by default unless ... I don't consider a method's return type/value to be it's parameter. It is only part of its signature, so this is kind of ambiguous for me. The Java tutorial for methods seems to think like me. As Joachim Sauer pointed out for me in the comments section of his answer , the name @ParametersAreNonnullByDefault ( parameters ) should've clearly indicated for me that this annotation doesn

How to indicate that member fields are @Nonnull by default?

為{幸葍}努か 提交于 2019-12-04 10:01:23
问题 My question is a follow-up to this one. In past versions of FindBugs, it was possible to use @DefaultAnnotation(Nonnull.class) or @DefaultAnnotationForFields(Nonnull.class) to indicate that all fields in a package should be treated as @Nonnull . In the current version of FindBugs (2.0), @DefaultAnnotation and @DefaultAnnotationForFields are deprecated, and we should all use JSR-305 instead. But JSR-305 doesn't seem to cover everything the (now deprecated) FindBugs annotations cover. The