Most voted "annotation" questions
52 questions
Sort by count of
-
12
votes2
answers200
viewsWhat are attributes in PHP? (Annotations/Attributes/Decorators)
Lately I have come across some snippets of code that I can’t understand their purpose, are usually used within comments, which doesn’t make much sense to me. Doing research on this subject falls in…
-
9
votes1
answer10051
viewsWhat is the difference between @Postconstruct and the constructor?
What’s the difference of using the annotation @PostConstruct instead of using constructor method and its advantages? I ask based on these two versions of the same class that only differ by this…
-
9
votes1
answer6033
viewsUsing @Supresswarnings in Java
Good morning. Until when it is recommended to use the annotation @SuppressWarnings to hide a Warning of a certain problem that the compiler finds in your code and show that you know what you’re…
-
7
votes1
answer239
viewsWhat is the difference between method annotation and attribute annotation
Guys, I started learning and using the hibernate recently, and while searching for answers to my questions regarding the annotations I have come across following occasions: 1st) The attribute has…
-
7
votes2
answers534
viewsIs it possible to change the value of an annotation at runtime?
Considering the following annotation: @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface MinhaAnotacao { String valor(); } Defined in a class: @MinhaAnotacao(valor =…
-
6
votes1
answer289
viewsHow to popular a dynamically select or checkbox using Annotations in ZF 2’s Zend Form?
I learned to do this with fixed values, example: @Annotation\Type("Zend\Form\Element\Select") @Annotation\Options({"label":"Cidade"}) @Annotation\Attributes({"options":{"1":"São Paulo","2":"Rio de…
-
5
votes1
answer12035
viewsOperation of the Spring Framework @Transactional
1 - The Spring documentation describes the use of @Transactional Spring in the business rule classes(ProdutosService for example) there is some special reason to use this annotation in these classes…
-
4
votes1
answer1381
viewsWhen should I use the @Enableautoconfiguration annotation and how does it work?
The Annotation EnableAutoConfiguration should be used in what type of project? and how it works in the application?
-
4
votes1
answer893
viewsI cannot ignore fields when trying to return them as Json causing "Infinite recursion"
I’m working with Hibernate, Spring and Jackson (to ignore fields) and when trying to return the class User in a json request java returns error due to mapping @Onetomany and @Manytoone with class…
-
4
votes2
answers252
viewsScope equivalent to @Stateless on CDI
I’m migrating the notes EJB from my application to CDI and I have some doubts: What is the equivalent scope @Stateless of the EJB at the CDI? The @ResquestScoped would act in an equivalent manner? I…
-
3
votes1
answer73
viewsIs it possible to know which JEE Container is being used during Dispatcher Servlet startup?
After some difficulties with the use of the Spring Security and JBoss using annotations based on API Servlet 3 (Servlet 3.1 more specifically), I discovered that when using Spring with JBoss, in…
-
3
votes1
answer1148
viewsHow to structure Hibernate Entity relationship annotations?
I would like to understand the difference between Hibernate annotations with JPA: @Onetoone, @Onetomany, @Manytomany and @Manytoone from Hibernate, how it works?
-
3
votes2
answers446
viewsJava Spring Extender @Scheduled to read a file
I have tasks to do as soon as I top up my application, they run over and over again that way: @Scheduled(fixedRate = 10000) public void scheduleFixedRateTask() { System.out.println("Fixed rate task…
-
3
votes1
answer166
viewsHow to map a column that does not exist in the bank?
I have a small problem when mapping (JPA) the columns of a class of my system. I have some procedures in bank that do a lot of things already and would not like to stop using them, but I do not know…
-
3
votes1
answer412
viewsClass attribute with predetermined values
I want to create a class attribute for sex (M or F), that by default one can already select. It is possible to create an array with these values (M and F) already default without having to type, or…
-
2
votes1
answer552
viewsHow to accept 0 and negative values in decimal attribute using Dataannotations?
I have a class with values decimal which may receive a value of -10.00 to 10.00 (including 0), in Sql Server the equivalent value is a Numeric(5,2). The problem is that by creating my class…
-
2
votes1
answer2708
viewsHow to configure ASP.NET MVC validation to accept en-BR dates?
I can’t get the date formatting right in my forms. I tried several cases, all using the same view: @Html.EditorFor(model => model.Data, new { htmlAttributes = new { @class = "form-control" } })…
-
2
votes1
answer347
viewsValidate with object Annotations within a method
I have a Javabean with several attributes that need to be validated. It has an attribute of type Enum, and according to the value of that attribute, the object needs some specific validations, and…
-
2
votes1
answer56
viewsWhy instantiating objects using new keyword is hardcoded?
I am learning Spring, and several times I have come across instructors solving the "problem" of instantiation of objects being made by keyword new, as in: private SpeakerRepository repository = new…
-
2
votes2
answers1050
viewsAnnotation problem for mapping
I’m having errors due to my mapping to my java program, I’m still starting to mess with Annotation (I ask you to forgive possible stupid xD errors). Error must be on @Manytoone/Onetomany... I have…
-
2
votes0
answers94
viewsA help with Spring Boot Annotations
A help with Annotations ... Today my tests are like this : @ConfigA @ConfigB @ConfigC @ConfigD public class MeuTesteA {} @ConfigA @ConfigB @ConfigC @ConfigD public class MeuTesteB {} See, I have to…
-
1
votes1
answer33
viewsUpdate Annotations
I need to update the map’s Annotations after inserting values into Coredata. i have the first view with the map, and a second where I add the new values for new Annotations, but only when I first…
-
1
votes1
answer472
viewsFormat mask for Timestamp attribute
I need to display the value of the TIME attribute only HH:mm (hour and minutes). By including the following masks an error occurs: The input character string was not in an incorrect format. I tried…
-
1
votes2
answers50
viewsIs there an API to create a similar Google Directory API service?
I find Google’s Directory API very interesting for bringing together documentation and testing environment in an objective and well organized way. I wonder if there is a similar plugin that can be…
-
1
votes2
answers544
viewsChange Color of an Error Message using Annotation
Where can I change the color of that ErrorMessage?…
-
1
votes0
answers89
viewsHow do Java annotations work?
I would like to know how EJB annotations are made in Java, those that start with "@"
-
1
votes1
answer404
viewsThe import org.springframework.web.bind.Annotation.Crossorigin cannot be resolved
I’m not managing to import the Annotation @CrossOrigin. ide does not find the necessary package despite all the others Annotations are working normally. The error that occurs is this: The import…
-
1
votes0
answers35
viewsIs it possible to assign the same URL to more than one controller?
I’m trying to use AJAX $.ajax({ url : urlN, // <<- "/log" type: "post", success : function(json) { console.log(json); document.getElementById('content').innerHTML = json; }…
-
1
votes1
answer277
viewscommit with the @Transactional annotation in Spring
Good afternoon! I am new to Java and Spring and I am in need of help in the code below. I need every iteration of for to be performed the commit, but it is only being performed at the end of the…
-
1
votes0
answers212
viewsGoogle Charts Annotation outside the column
When creating the chart, with Annotations for the column, on account of 'Stem', even defining its color as 'Transparent', it remains there, occupying space, how to put an annotation inside the…
-
0
votes1
answer199
viewsDataannotation validations do not work on properties with Notmapped attribute in EF6
I upgraded the Entity Framework version from 5 to 6 in my project, and Context.Savechanges from the Data Repository stopped working only in some cases. I found that using Dataannotation in the…
-
0
votes1
answer66
viewsAndroid Setting Name with brackets in body json parameter
I’m having the following problem: I’m using the Android Rest API library https://github.com/excilys/androidannotations/wiki/Rest-API, and I’m trying a post, but the post only accepts a single…
-
0
votes0
answers319
viewsUse same parent table id in daughter - Hibernate
I’m having trouble setting up and treating the use of ID in parent/child classes using Hibernate. I get everything to work properly when the record does not exist in the parent table (records are…
-
0
votes1
answer298
viewsDate validation with Dataannotation
I wanted to know if you have how to validate if the Date entered is higher or not than the current date using Annotation, or if I have to deal with the same controller. If you can, please provide an…
-
0
votes1
answer62
viewsGrouping only by Manytomany’s first item in Django
I have two tables: Author and Book where Book has an Author = ManyToManyField Note the examples with A1 (author one) and L1 (book one), so on. Author - Book A1 - L1, L2, L3 A2 - L1 A1 - L3 A1 - L1…
-
0
votes1
answer71
viewsAnnotation @Get does not work in controller
I am trying to customize my url with @Get on Vraptor 4, but it is not recognized, Follow the controller: @Controller public class OlaController { @Inject Result result; @Get("/ola") public void…
-
0
votes0
answers24
viewsA Restcontroller bean at the same time being a Configuration bean and a Component bean hurts SRP?
In a Java application with Spring I came across a class annotated as follows: import ... @Component @RestController @Configuration public class MySender { ... } At first glance I suspected that…
-
0
votes1
answer728
viewsSpring MVC annotations not working on Maven
Hi, I’m having a problem setting up Spring MVC in the Maven, when I try to access the http://localhost:8080/spring/olaMundoSpring it returns in browser: STATUS 404 The requested Resource is not…
-
0
votes1
answer151
viewsxml error Annotation
I’m having a problem when running my program and have no idea what might be wrong, I made a Java program with Annotations. Would anyone know to tell me? [Fatal Error] :8:83: The "Property" element…
-
0
votes3
answers814
viewsI cannot display Spring error message
I’m trying to validate some annotated fields, but I can’t bring the messages to the jsp page: Java user. mport java.util.Calendar; import javax.validation.constraints.Email; import…
-
0
votes2
answers154
viewsInheritance persistence, one-to-one relationship and manual primary key
I’m developing a heritage web project to finish my degree. I am using Java (IDE: Spring Tool Suite), Spring, Hibernate and Mysql. I’m having a data modeling problem that I’m having trouble solving:…
-
0
votes1
answer134
views@joincolunm with foreignKey Hibernate
Hello I wanted to make a foreign key, but I don’t understand the syntax. In the Endereco class: @Embeddable @Table(name = "tab_endereco") public class Endereco { @Column(length = 40, nullable =…
-
0
votes1
answer41
viewsInsert using Many to Many Annotation does not work
Hello, I have a Many to Many relationship between TEAM and NEWS. I am trying to create a method to insert a "NEWS". I am using Hibernate with Annotation to map the classes. The Insert works and…
-
0
votes1
answer735
viewsHow to map a table without ID, using Hibernate annnotaions?
Hello, good morning, sir. Having a table that relates USER and ACHIEVEMENTS called USER_ACHIEVEMENTS, where it does not have ID, only USER_ID and ACHIEVEMENTS_ID, ie a manyToMany relationship. How…
-
0
votes1
answer75
viewsHow to pass a parameter from one Annotation to another?
How can I replace the value of @ConditionalOnExpression by the value passed in the SecurityConfig? Current code: @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) @EnableWebSecurity…
-
0
votes0
answers587
viewsHow to create an Annotation to validate data from a DTO in Java?
I have a class of a DTO object that I receive in my control through a request using REST. See an example of a request using the verb Post: @PostMapping public…
-
0
votes1
answer68
viewsWhat Spring annotation I need to use with Mqttcallback messageArrived
I am new to Spring and am trying to insert in my Mysql database from the message received from MQTT. I created my application as follows: public static void main(String[] args) throws…
-
0
votes0
answers34
viewsUser marking and annotation system
Hello, I’m new to programming and am trying to develop an educational platform for my company. So far, I have the chapters saved in my database as richtext and students will be able to access them…
-
0
votes0
answers29
viewsAnnotation java + spring boot
I need to take an attribute of an object and modify its value via Annotation, for example: public class MeuDTO { @AlgumaAnnotation private String meuAtributo; } I created the note:…
-
0
votes0
answers22
viewsAuditoria Hibernate
I am trying to accomplish the construction of a history of a given table. @Entity @Table(name = "RUBRICA_INSTITUTO) @Getter @Setter @Audited @Audittable( "RUBRICA_INSTITUTO_AUDITORIA" )…