Merge pull request #8401 from kwoyke/BAEL-19967
BAEL-19967: Migrate some spring-* modules to the com.baeldung package
This commit is contained in:
+2
-4
@@ -1,4 +1,4 @@
|
||||
package org.baeldung.akka;
|
||||
package com.baeldung.akka;
|
||||
|
||||
import akka.actor.ActorSystem;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -7,8 +7,6 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import static org.baeldung.akka.SpringExtension.SPRING_EXTENSION_PROVIDER;
|
||||
|
||||
@Configuration
|
||||
@ComponentScan
|
||||
public class AppConfiguration {
|
||||
@@ -19,7 +17,7 @@ public class AppConfiguration {
|
||||
@Bean
|
||||
public ActorSystem actorSystem() {
|
||||
ActorSystem system = ActorSystem.create("akka-spring-demo");
|
||||
SPRING_EXTENSION_PROVIDER.get(system).initialize(applicationContext);
|
||||
SpringExtension.SPRING_EXTENSION_PROVIDER.get(system).initialize(applicationContext);
|
||||
return system;
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.baeldung.akka;
|
||||
package com.baeldung.akka;
|
||||
|
||||
import akka.actor.UntypedActor;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.baeldung.akka;
|
||||
package com.baeldung.akka;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.baeldung.akka;
|
||||
package com.baeldung.akka;
|
||||
|
||||
import akka.actor.Actor;
|
||||
import akka.actor.IndirectActorProducer;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.baeldung.akka;
|
||||
package com.baeldung.akka;
|
||||
|
||||
import akka.actor.AbstractExtensionId;
|
||||
import akka.actor.ExtendedActorSystem;
|
||||
+3
-3
@@ -1,11 +1,11 @@
|
||||
package org.baeldung.akka;
|
||||
package com.baeldung.akka;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import akka.actor.ActorRef;
|
||||
import akka.actor.ActorSystem;
|
||||
import akka.util.Timeout;
|
||||
import org.baeldung.akka.GreetingActor.Greet;
|
||||
import com.baeldung.akka.GreetingActor.Greet;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
@@ -17,7 +17,7 @@ import scala.concurrent.Future;
|
||||
import scala.concurrent.duration.FiniteDuration;
|
||||
|
||||
import static akka.pattern.Patterns.ask;
|
||||
import static org.baeldung.akka.SpringExtension.SPRING_EXTENSION_PROVIDER;
|
||||
import static com.baeldung.akka.SpringExtension.SPRING_EXTENSION_PROVIDER;
|
||||
|
||||
@ContextConfiguration(classes = AppConfiguration.class)
|
||||
public class SpringAkkaIntegrationTest extends AbstractJUnit4SpringContextTests {
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.baeldung;
|
||||
package com.baeldung;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package org.baeldung;
|
||||
package com.baeldung;
|
||||
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
@@ -9,7 +9,7 @@ import org.springframework.stereotype.Component;
|
||||
@Component
|
||||
public class ExampleAspect {
|
||||
|
||||
@Around("@annotation(LogExecutionTime)")
|
||||
@Around("@annotation(com.baeldung.LogExecutionTime)")
|
||||
public Object logExecutionTime(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||
final long start = System.currentTimeMillis();
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.baeldung;
|
||||
package com.baeldung;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.baeldung;
|
||||
package com.baeldung;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.baeldung.aspectj;
|
||||
package com.baeldung.aspectj;
|
||||
|
||||
public class Account {
|
||||
int balance = 20;
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package org.baeldung.aspectj;
|
||||
package com.baeldung.aspectj;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -8,7 +8,7 @@ public aspect AccountAspect {
|
||||
final int MIN_BALANCE = 10;
|
||||
|
||||
pointcut callWithDraw(int amount, Account account):
|
||||
call(boolean Account.withdraw(int)) && args(amount) && target(account);
|
||||
call(boolean com.baeldung.aspectj.Account.withdraw(int)) && args(amount) && target(account);
|
||||
|
||||
before(int amount, Account account) : callWithDraw(amount, account) {
|
||||
logger.info(" Balance before withdrawal: {}", account.balance);
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.baeldung.aspectj;
|
||||
package com.baeldung.aspectj;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.baeldung.aspectj;
|
||||
package com.baeldung.aspectj;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.baeldung.aspectj;
|
||||
package com.baeldung.aspectj;
|
||||
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
+13
-13
@@ -1,13 +1,13 @@
|
||||
package org.baeldung.logger;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class AdderAfterAspect {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
public void afterAdvice() throws Throwable {
|
||||
logger.info("I'm done calling the method");
|
||||
}
|
||||
}
|
||||
package com.baeldung.logger;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class AdderAfterAspect {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
public void afterAdvice() throws Throwable {
|
||||
logger.info("I'm done calling the method");
|
||||
}
|
||||
}
|
||||
+13
-13
@@ -1,13 +1,13 @@
|
||||
package org.baeldung.logger;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class AdderAfterReturnAspect {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
public void afterReturn(final Object returnValue) throws Throwable {
|
||||
logger.info("value return was {}", returnValue);
|
||||
}
|
||||
}
|
||||
package com.baeldung.logger;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class AdderAfterReturnAspect {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
public void afterReturn(final Object returnValue) throws Throwable {
|
||||
logger.info("value return was {}", returnValue);
|
||||
}
|
||||
}
|
||||
+13
-13
@@ -1,13 +1,13 @@
|
||||
package org.baeldung.logger;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class AdderAfterThrowAspect {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
public void afterThrow(final Exception exception) throws Throwable {
|
||||
logger.info("Exception thrown was {}", exception.getMessage());
|
||||
}
|
||||
}
|
||||
package com.baeldung.logger;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class AdderAfterThrowAspect {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
public void afterThrow(final Exception exception) throws Throwable {
|
||||
logger.info("Exception thrown was {}", exception.getMessage());
|
||||
}
|
||||
}
|
||||
+18
-18
@@ -1,18 +1,18 @@
|
||||
package org.baeldung.logger;
|
||||
|
||||
import java.util.Arrays;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class AdderAroundAspect {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
public Object aroundAdvice(final ProceedingJoinPoint joinPoint) throws Throwable {
|
||||
logger.info("Arguments passed to method are: " + Arrays.toString(joinPoint.getArgs()));
|
||||
final Object result = joinPoint.proceed();
|
||||
logger.info("Result from method is: " + result);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
package com.baeldung.logger;
|
||||
|
||||
import java.util.Arrays;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class AdderAroundAspect {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
public Object aroundAdvice(final ProceedingJoinPoint joinPoint) throws Throwable {
|
||||
logger.info("Arguments passed to method are: " + Arrays.toString(joinPoint.getArgs()));
|
||||
final Object result = joinPoint.proceed();
|
||||
logger.info("Result from method is: " + result);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
+13
-13
@@ -1,13 +1,13 @@
|
||||
package org.baeldung.logger;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class AdderBeforeAspect {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
public void beforeAdvice() throws Throwable {
|
||||
logger.info("I would be executed just before method starts");
|
||||
}
|
||||
}
|
||||
package com.baeldung.logger;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class AdderBeforeAspect {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
public void beforeAdvice() throws Throwable {
|
||||
logger.info("I would be executed just before method starts");
|
||||
}
|
||||
}
|
||||
+12
-12
@@ -1,12 +1,12 @@
|
||||
package org.baeldung.logger;
|
||||
|
||||
public class SampleAdder {
|
||||
|
||||
public int add(int a, int b) {
|
||||
if (a < 0 || b < 0) {
|
||||
throw new IllegalArgumentException("Make sure all the arguments are greater than zero.");
|
||||
}
|
||||
return a + b;
|
||||
}
|
||||
|
||||
}
|
||||
package com.baeldung.logger;
|
||||
|
||||
public class SampleAdder {
|
||||
|
||||
public int add(int a, int b) {
|
||||
if (a < 0 || b < 0) {
|
||||
throw new IllegalArgumentException("Make sure all the arguments are greater than zero.");
|
||||
}
|
||||
return a + b;
|
||||
}
|
||||
|
||||
}
|
||||
+5
-5
@@ -1,4 +1,4 @@
|
||||
package org.baeldung.performancemonitor;
|
||||
package com.baeldung.performancemonitor;
|
||||
|
||||
import org.aspectj.lang.annotation.Pointcut;
|
||||
import org.springframework.aop.Advisor;
|
||||
@@ -16,10 +16,10 @@ import java.time.Month;
|
||||
@EnableAspectJAutoProxy
|
||||
public class AopConfiguration {
|
||||
|
||||
@Pointcut("execution(public String org.baeldung.performancemonitor.PersonService.getFullName(..))")
|
||||
@Pointcut("execution(public String com.baeldung.performancemonitor.PersonService.getFullName(..))")
|
||||
public void monitor() { }
|
||||
|
||||
@Pointcut("execution(public int org.baeldung.performancemonitor.PersonService.getAge(..))")
|
||||
@Pointcut("execution(public int com.baeldung.performancemonitor.PersonService.getAge(..))")
|
||||
public void myMonitor() { }
|
||||
|
||||
@Bean
|
||||
@@ -30,7 +30,7 @@ public class AopConfiguration {
|
||||
@Bean
|
||||
public Advisor performanceMonitorAdvisor() {
|
||||
AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut();
|
||||
pointcut.setExpression("org.baeldung.performancemonitor.AopConfiguration.monitor()");
|
||||
pointcut.setExpression("com.baeldung.performancemonitor.AopConfiguration.monitor()");
|
||||
return new DefaultPointcutAdvisor(pointcut, performanceMonitorInterceptor());
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public class AopConfiguration {
|
||||
@Bean
|
||||
public Advisor myPerformanceMonitorAdvisor() {
|
||||
AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut();
|
||||
pointcut.setExpression("org.baeldung.performancemonitor.AopConfiguration.myMonitor()");
|
||||
pointcut.setExpression("com.baeldung.performancemonitor.AopConfiguration.myMonitor()");
|
||||
return new DefaultPointcutAdvisor(pointcut, myPerformanceMonitorInterceptor());
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.baeldung.performancemonitor;
|
||||
package com.baeldung.performancemonitor;
|
||||
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
import org.apache.commons.logging.Log;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.baeldung.performancemonitor;
|
||||
package com.baeldung.performancemonitor;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.baeldung.performancemonitor;
|
||||
package com.baeldung.performancemonitor;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.baeldung.performancemonitor;
|
||||
package com.baeldung.performancemonitor;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.Period;
|
||||
@@ -1,6 +1,6 @@
|
||||
<aspectj>
|
||||
<aspects>
|
||||
<aspect name="org.baeldung.aspectj.SecuredMethodAspect"/>
|
||||
<aspect name="com.baeldung.aspectj.SecuredMethodAspect"/>
|
||||
<weaver options="-verbose -showWeaveInfo">
|
||||
<include within="com.baeldung.aspectj.*"/>
|
||||
</weaver>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<!-- in order to debug some marshalling issues, this needs to be TRACE -->
|
||||
<logger name="org.springframework.web.servlet.mvc" level="WARN" />
|
||||
|
||||
<logger name="org.baeldung.performancemonitor.MyPerformanceMonitorInterceptor" level="INFO" />
|
||||
<logger name="com.baeldung.performancemonitor.MyPerformanceMonitorInterceptor" level="INFO" />
|
||||
|
||||
<logger name="org.springframework.aop.interceptor.PerformanceMonitorInterceptor" level="TRACE" />
|
||||
|
||||
|
||||
+11
-11
@@ -6,45 +6,45 @@
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.2.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.2.xsd">
|
||||
|
||||
<bean id="sampleAdder"
|
||||
class="org.baeldung.logger.SampleAdder" />
|
||||
class="com.baeldung.logger.SampleAdder" />
|
||||
|
||||
<bean id="doBeforeAspect" class="org.baeldung.logger.AdderBeforeAspect" />
|
||||
<bean id="doAfterAspect" class="org.baeldung.logger.AdderAfterAspect" />
|
||||
<bean id="doAfterThrowingAspect" class="org.baeldung.logger.AdderAfterThrowAspect" />
|
||||
<bean id="doAfterReturningAspect" class="org.baeldung.logger.AdderAfterReturnAspect" />
|
||||
<bean id="doAroundAspect" class="org.baeldung.logger.AdderAroundAspect" />
|
||||
<bean id="doBeforeAspect" class="com.baeldung.logger.AdderBeforeAspect" />
|
||||
<bean id="doAfterAspect" class="com.baeldung.logger.AdderAfterAspect" />
|
||||
<bean id="doAfterThrowingAspect" class="com.baeldung.logger.AdderAfterThrowAspect" />
|
||||
<bean id="doAfterReturningAspect" class="com.baeldung.logger.AdderAfterReturnAspect" />
|
||||
<bean id="doAroundAspect" class="com.baeldung.logger.AdderAroundAspect" />
|
||||
|
||||
<aop:config>
|
||||
|
||||
<aop:aspect id="aspects" ref="doBeforeAspect">
|
||||
<aop:pointcut id="pointCutBefore"
|
||||
expression="execution(* org.baeldung.logger.SampleAdder+.*(..))" />
|
||||
expression="execution(* com.baeldung.logger.SampleAdder+.*(..))" />
|
||||
<aop:before method="beforeAdvice" pointcut-ref="pointCutBefore" />
|
||||
</aop:aspect>
|
||||
|
||||
<aop:aspect id="aspects" ref="doAfterAspect">
|
||||
<aop:pointcut id="pointCutAfter"
|
||||
expression="execution(* org.baeldung.logger.SampleAdder+.*(..))" />
|
||||
expression="execution(* com.baeldung.logger.SampleAdder+.*(..))" />
|
||||
<aop:after method="afterAdvice" pointcut-ref="pointCutAfter" />
|
||||
</aop:aspect>
|
||||
|
||||
<aop:aspect id="aspects" ref="doAfterReturningAspect">
|
||||
<aop:pointcut id="pointCutAfterReturning"
|
||||
expression="execution(* org.baeldung.logger.SampleAdder+.*(..))" />
|
||||
expression="execution(* com.baeldung.logger.SampleAdder+.*(..))" />
|
||||
<aop:after-returning method="afterReturn"
|
||||
returning="returnValue" pointcut-ref="pointCutAfterReturning" />
|
||||
</aop:aspect>
|
||||
|
||||
<aop:aspect id="aspects" ref="doAfterThrowingAspect">
|
||||
<aop:pointcut id="pointCutAfterThrowing"
|
||||
expression="execution(* org.baeldung.logger.SampleAdder+.*(..))" />
|
||||
expression="execution(* com.baeldung.logger.SampleAdder+.*(..))" />
|
||||
<aop:after-throwing method="afterThrow"
|
||||
throwing="error" pointcut-ref="pointCutAfterThrowing" />
|
||||
</aop:aspect>
|
||||
|
||||
<aop:aspect id="aspects" ref="doAroundAspect">
|
||||
<aop:pointcut id="pointCutAround"
|
||||
expression="execution(* org.baeldung.logger.SampleAdder+.*(..))" />
|
||||
expression="execution(* com.baeldung.logger.SampleAdder+.*(..))" />
|
||||
<aop:around method="aroundAdvice" pointcut-ref="pointCutAround" />
|
||||
</aop:aspect>
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.baeldung;
|
||||
package com.baeldung;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user