Skip to content

Commit f7995e4

Browse files
author
sbalachandran
committed
Merge remote-tracking branch 'upstream/master'
Conflicts: hystrix/src/test/java/com/baeldung/hystrix/HystrixTimeoutTest.java
2 parents cfeaa4e + dedf3f3 commit f7995e4

542 files changed

Lines changed: 9492 additions & 5367 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "testgitrepo"]
2+
path = testgitrepo
3+
url = /home/prd/Development/projects/idea/tutorials/spring-boot/src/main/resources/testgitrepo/

apache-fop/.externalToolBuilders/org.eclipse.wst.jsdt.core.javascriptValidator.launch

Lines changed: 0 additions & 7 deletions
This file was deleted.

cdi/pom.xml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>com.baeldung</groupId>
8+
<artifactId>cdi</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
<properties>
11+
<spring.version>4.3.1.RELEASE</spring.version>
12+
</properties>
13+
<dependencies>
14+
<!-- https://mvnrepository.com/artifact/junit/junit -->
15+
<dependency>
16+
<groupId>junit</groupId>
17+
<artifactId>junit</artifactId>
18+
<version>4.12</version>
19+
</dependency>
20+
<!-- https://mvnrepository.com/artifact/org.springframework/spring-core -->
21+
<dependency>
22+
<groupId>org.springframework</groupId>
23+
<artifactId>spring-core</artifactId>
24+
<version>${spring.version}</version>
25+
</dependency>
26+
<!-- https://mvnrepository.com/artifact/org.springframework/spring-context -->
27+
<dependency>
28+
<groupId>org.springframework</groupId>
29+
<artifactId>spring-context</artifactId>
30+
<version>${spring.version}</version>
31+
</dependency>
32+
<!-- https://mvnrepository.com/artifact/org.springframework/spring-test -->
33+
<dependency>
34+
<groupId>org.springframework</groupId>
35+
<artifactId>spring-test</artifactId>
36+
<version>${spring.version}</version>
37+
<scope>test</scope>
38+
</dependency>
39+
<!-- https://mvnrepository.com/artifact/org.aspectj/aspectjweaver -->
40+
<dependency>
41+
<groupId>org.aspectj</groupId>
42+
<artifactId>aspectjweaver</artifactId>
43+
<version>1.8.9</version>
44+
</dependency>
45+
<!-- https://mvnrepository.com/artifact/org.jboss.weld.se/weld-se-core -->
46+
<dependency>
47+
<groupId>org.jboss.weld.se</groupId>
48+
<artifactId>weld-se-core</artifactId>
49+
<version>2.3.5.Final</version>
50+
</dependency>
51+
</dependencies>
52+
</project>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.baeldung.interceptor;
2+
3+
import javax.interceptor.InterceptorBinding;
4+
import java.lang.annotation.ElementType;
5+
import java.lang.annotation.Retention;
6+
import java.lang.annotation.RetentionPolicy;
7+
import java.lang.annotation.Target;
8+
9+
@InterceptorBinding
10+
@Target( {ElementType.METHOD, ElementType.TYPE } )
11+
@Retention(RetentionPolicy.RUNTIME )
12+
public @interface Audited {}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.baeldung.interceptor;
2+
3+
import javax.interceptor.AroundInvoke;
4+
import javax.interceptor.Interceptor;
5+
import javax.interceptor.InvocationContext;
6+
import java.lang.reflect.Method;
7+
8+
@Audited @Interceptor
9+
public class AuditedInterceptor {
10+
public static boolean calledBefore = false;
11+
public static boolean calledAfter = false;
12+
@AroundInvoke
13+
public Object auditMethod(InvocationContext ctx) throws Exception {
14+
calledBefore = true;
15+
Object result = ctx.proceed();
16+
calledAfter = true;
17+
return result;
18+
}
19+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.baeldung.service;
2+
3+
import com.baeldung.interceptor.Audited;
4+
5+
public class SuperService {
6+
@Audited
7+
public String deliverService(String uid) {
8+
return uid;
9+
}
10+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.baeldung.spring.aspect;
2+
3+
import org.aspectj.lang.JoinPoint;
4+
import org.aspectj.lang.ProceedingJoinPoint;
5+
import org.aspectj.lang.annotation.Around;
6+
import org.aspectj.lang.annotation.Aspect;
7+
import org.aspectj.lang.annotation.Before;
8+
import org.springframework.beans.factory.annotation.Autowired;
9+
10+
import javax.inject.Inject;
11+
import java.util.List;
12+
13+
@Aspect
14+
public class SpringTestAspect {
15+
@Autowired
16+
private List<String> accumulator;
17+
18+
@Around("execution(* com.baeldung.spring.service.SpringSuperService.*(..))")
19+
public Object advice(ProceedingJoinPoint jp) throws Throwable {
20+
String methodName = jp.getSignature().getName();
21+
accumulator.add("Call to "+methodName);
22+
Object obj = jp.proceed();
23+
accumulator.add("Method called successfully: "+methodName);
24+
return obj;
25+
}
26+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package com.baeldung.spring.configuration;
2+
3+
import com.baeldung.spring.aspect.SpringTestAspect;
4+
import com.baeldung.spring.service.SpringSuperService;
5+
import org.springframework.context.annotation.Bean;
6+
import org.springframework.context.annotation.Configuration;
7+
import org.springframework.context.annotation.EnableAspectJAutoProxy;
8+
9+
import java.util.ArrayList;
10+
import java.util.List;
11+
12+
@Configuration
13+
@EnableAspectJAutoProxy
14+
public class AppConfig {
15+
@Bean
16+
public SpringSuperService springSuperService() {
17+
return new SpringSuperService();
18+
}
19+
20+
@Bean
21+
public SpringTestAspect springTestAspect(){
22+
return new SpringTestAspect();
23+
}
24+
25+
@Bean
26+
public List<String> getAccumulator(){
27+
return new ArrayList<String>();
28+
}
29+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.baeldung.spring.service;
2+
3+
public class SpringSuperService {
4+
public String getInfoFromService(String code){
5+
return code;
6+
}
7+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<beans xmlns="http://java.sun.com/xml/ns/javaee"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
4+
http://java.sun.com/xml/ns/javaee/beans_1_2.xsd">
5+
<interceptors>
6+
<class>com.baeldung.interceptor.AuditedInterceptor</class>
7+
</interceptors>
8+
</beans>

0 commit comments

Comments
 (0)