Java Annotation筆記

in java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
public class AnnotationTest {
private Logger log = LoggerFactory.getLogger(this.getClass());
@Test
public void test() throws Exception {
Field f_b = Test1.class.getDeclaredField("b");
Annotation annotation_b = f_b.getAnnotation(Ignore.class);
Field f_a = Test1.class.getDeclaredField("a");
Annotation annotation_a = f_a.getAnnotation(Ignore.class);
log.info("" + annotation_a);
log.info("" + annotation_b);
}
}
class Test1 {
String a;
@Ignore
String b;
}

Comment and share

Spring要用3.1以上版本

applicationContex.xml
1
2
3
4
5
6
7
8
<beans>
<beans profile="LOCAL">
<context:property-placeholder location="classpath*:META-INF/spring/local/*.properties" />
</beans>
<beans profile="PRODUCTION">
<context:property-placeholder location="classpath*:META-INF/spring/production/*.properties" />
</beans>
</beans>

Continue reading

Cwza

Hello everyone.
I’m cwza.
Welcome to my blog.


Software Engineer


Taiwan/Taipei