reports an exception in the following code in advance, check whether @ Component is correctly added to the Bean.
Annotation, but the @ Controller is not configured in the Controller layer, the Service may not encounter exceptions at startup, but you will find that the URL address in the page request is correct, at that time, no matter how you access
Check whether the @ Controller
Java custom Annotation to get the Annotation value set by Annotation in the Annotation class
Java annotation mechanism is widely used in various frameworks. Some values can be set in an
[Java]@ Resource and @ Component implement zero XML configuration1. @ Resource annotation:@ Resource is the annotation of J2EE. It means to find the corresponding resources in the container. You can also specify its name resource through the name attribute. It can be annotated to field or setter.Public class UserAction
Java annotation mechanism is widely used in various frameworks, and some values can be set in annotations.To get the annotation value set in the annotation class annotation: traverse the method in the custom annotation, reflect th
;
Note: To use annotations, you must configure
@ Controller, @ Service, @ Repository is the refinement of @ Component. These three annotations have more semantics than @ Component, they correspond to the control layer, service layer, and persistent layer classes respectively.
@ Component refers to a Component
Spring for Java EE development, including condition annotation, combination annotation and meta annotation, and javaeespring
In the previous blog, we talked in detail about multithreaded programming and task timer in Spring developed by JavaEE. In this blog, we will talk about condition
is userServiceIml3public class UserServiceIml3 implements UserService {}
We can update the default naming mechanism of Spring, as long as we implement the relevant interface BeanNameGenerator and configure it as follows:
Others
In XML-based configuration, bean labels also have many attributes, such as scope, Lazy, init-method, depends-on, and Qualifier. The following is a simple configuration example:
Package com. test. service; import java.
Java: annotation (metadata), java annotation metadata
Java Annotation
The so-called Metadata refers to the data used to describe the data. You may be a little unfamiliar when you hear the metadata, in fact, any developer who has u
Java Annotation trial and Java Annotation trial
Many features of Java are similar, such as multithreading, io, and collection classes. However, they are not summarized. Today Annotation is used, so let's just summarize it.
To us
, then scans the class and jar files under the specified package according to the attribute base-package in context: component-scan, and marks the @ Controller as the web Controller, @ Service: Mark the services at the Servicec layer. @ Respository: mark all the annotations such as data access at the DAO layer, and register them as Bean classes in the Bean Factory. Next we will analyze this process. We usually use this
Spring annotation injection: (context: component-scan)
Spring versions 2.5 support annotation injection, which saves a lot of xml configuration work. Because annotations are written into java code, annotation injection will lose some flexibility. We need to choose whether to
Java uses the annotation processor to generate code-Part 2: annotation Processor
This article is part 2 of my "using annotation processors to generate code for Java" series. In the first part (please read here), we will introduce Jav
Java reflection-annotation based on the framework and java reflection framework Annotation1. Concept
First, you must understand the functions of annotations. The function of annotation is simple and clear. It is a mark. If an annotation is added to a program, it is equivalen
Using annotation Assembly attributes in spring2.5It can be used in Java code@ ResourceOr@ AutowiredAnnotations for assembly, but the following information must be configured in XML:Xmlns: context = "http://www.springframework.org/schema/context"Xsi: schemalocation = "http://www.springframework.org/schema/contextHttp://www.springframework.org/schema/context/spring-context-2.5.xsd"Then explicitly configureThi
General Statement
about:This article is and (three) next to the Brother article, the Code is also (c) those.
content (This is just a beginner's entry, please look at the next step outside)
1 What is Component Scan 2 Specify scan class path3 annotation marks for auto scan4 Auto Scan annotation naming5 specifying the scope of a component6 specifying initializ
[Additional Points for the interview] java custom annotation declarative annotation, java custom
Previous blog posts.First, we need to declare an annotation. The declaration code is as follows:
Import java. lang.
Java @ annotation, java Annotation1. annotation Introduction
When developing Java programs, especially Java EE applications, it is always inevitable to deal with various configuration files. In
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.