Merge pull request #8401 from kwoyke/BAEL-19967

BAEL-19967: Migrate some spring-* modules to the com.baeldung package
This commit is contained in:
Josh Cummings 2019-12-23 09:20:59 -07:00 committed by GitHub
commit 173b370c56
93 changed files with 274 additions and 277 deletions

View File

@ -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;
}

View File

@ -1,4 +1,4 @@
package org.baeldung.akka;
package com.baeldung.akka;
import akka.actor.UntypedActor;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;

View File

@ -1,4 +1,4 @@
package org.baeldung.akka;
package com.baeldung.akka;
import org.springframework.stereotype.Component;

View File

@ -1,4 +1,4 @@
package org.baeldung.akka;
package com.baeldung.akka;
import akka.actor.Actor;
import akka.actor.IndirectActorProducer;

View File

@ -1,4 +1,4 @@
package org.baeldung.akka;
package com.baeldung.akka;
import akka.actor.AbstractExtensionId;
import akka.actor.ExtendedActorSystem;

View File

@ -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 {

View File

@ -1,4 +1,4 @@
package org.baeldung;
package com.baeldung;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

View File

@ -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();

View File

@ -1,4 +1,4 @@
package org.baeldung;
package com.baeldung;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;

View File

@ -1,4 +1,4 @@
package org.baeldung;
package com.baeldung;
import org.springframework.stereotype.Component;

View File

@ -1,4 +1,4 @@
package org.baeldung.aspectj;
package com.baeldung.aspectj;
public class Account {
int balance = 20;

View File

@ -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);

View File

@ -1,4 +1,4 @@
package org.baeldung.aspectj;
package com.baeldung.aspectj;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;

View File

@ -1,4 +1,4 @@
package org.baeldung.aspectj;
package com.baeldung.aspectj;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -1,4 +1,4 @@
package org.baeldung.aspectj;
package com.baeldung.aspectj;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;

View File

@ -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");
}
}

View File

@ -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);
}
}

View File

@ -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());
}
}

View File

@ -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;
}
}

View File

@ -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");
}
}

View File

@ -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;
}
}

View File

@ -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());
}

View File

@ -1,4 +1,4 @@
package org.baeldung.performancemonitor;
package com.baeldung.performancemonitor;
import org.aopalliance.intercept.MethodInvocation;
import org.apache.commons.logging.Log;

View File

@ -1,4 +1,4 @@
package org.baeldung.performancemonitor;
package com.baeldung.performancemonitor;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

View File

@ -1,4 +1,4 @@
package org.baeldung.performancemonitor;
package com.baeldung.performancemonitor;
import java.time.LocalDate;

View File

@ -1,4 +1,4 @@
package org.baeldung.performancemonitor;
package com.baeldung.performancemonitor;
import java.time.LocalDate;
import java.time.Period;

View File

@ -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>

View File

@ -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" />

View File

@ -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>

View File

@ -1,4 +1,4 @@
package org.baeldung;
package com.baeldung;
import org.junit.Test;
import org.junit.runner.RunWith;

View File

@ -1,4 +1,4 @@
package org.baeldung;
package com.baeldung;
import org.junit.Test;
import org.junit.runner.RunWith;

View File

@ -1,4 +1,4 @@
package org.baeldung.aspectj;
package com.baeldung.aspectj;
import org.junit.Before;
import org.junit.Test;

View File

@ -1,4 +1,4 @@
package org.baeldung.aspectj;
package com.baeldung.aspectj;
import org.junit.Test;

View File

@ -1,29 +1,29 @@
package org.baeldung.logger;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(value = {"classpath:springAop-applicationContext.xml"})
public class CalculatorIntegrationTest {
@Autowired
private SampleAdder sampleAdder;
@Test
public void whenAddValidValues_returnsSucessfully() {
final int addedValue = sampleAdder.add(12, 12);
assertEquals(24, addedValue);
}
@Test (expected = IllegalArgumentException.class)
public void whenAddInValidValues_throwsException() {
sampleAdder.add(12, -12);
}
}
package com.baeldung.logger;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(value = {"classpath:springAop-applicationContext.xml"})
public class CalculatorIntegrationTest {
@Autowired
private SampleAdder sampleAdder;
@Test
public void whenAddValidValues_returnsSucessfully() {
final int addedValue = sampleAdder.add(12, 12);
assertEquals(24, addedValue);
}
@Test (expected = IllegalArgumentException.class)
public void whenAddInValidValues_throwsException() {
sampleAdder.add(12, -12);
}
}

View File

@ -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="exception" 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>

View File

@ -1,4 +1,4 @@
package org.baeldung.caching.config;
package com.baeldung.caching.config;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;

View File

@ -1,4 +1,4 @@
package org.baeldung.caching.config;
package com.baeldung.caching.config;
import java.util.Arrays;
@ -12,7 +12,7 @@ import org.springframework.context.annotation.Configuration;
@Configuration
@EnableCaching
@ComponentScan("org.baeldung.caching.example")
@ComponentScan("com.baeldung.caching.example")
public class CachingConfig {
@Bean

View File

@ -1,4 +1,4 @@
package org.baeldung.caching.config;
package com.baeldung.caching.config;
import org.springframework.cache.interceptor.KeyGenerator;
import org.springframework.util.StringUtils;

View File

@ -1,6 +1,6 @@
package org.baeldung.caching.eviction.controllers;
package com.baeldung.caching.eviction.controllers;
import org.baeldung.caching.eviction.service.CachingService;
import com.baeldung.caching.eviction.service.CachingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

View File

@ -1,4 +1,4 @@
package org.baeldung.caching.eviction.service;
package com.baeldung.caching.eviction.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.CacheManager;

View File

@ -1,4 +1,4 @@
package org.baeldung.caching.example;
package com.baeldung.caching.example;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;

View File

@ -1,6 +1,6 @@
package org.baeldung.caching.example;
package com.baeldung.caching.example;
import org.baeldung.caching.model.Book;
import com.baeldung.caching.model.Book;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Component;

View File

@ -1,4 +1,4 @@
package org.baeldung.caching.example;
package com.baeldung.caching.example;
public class Customer {

View File

@ -1,4 +1,4 @@
package org.baeldung.caching.example;
package com.baeldung.caching.example;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;

View File

@ -1,4 +1,4 @@
package org.baeldung.caching.example;
package com.baeldung.caching.example;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.stereotype.Component;

View File

@ -1,4 +1,4 @@
package org.baeldung.caching.model;
package com.baeldung.caching.model;
public class Book {

View File

@ -1,6 +1,6 @@
package org.baeldung.ehcache.calculator;
package com.baeldung.ehcache.calculator;
import org.baeldung.ehcache.config.CacheHelper;
import com.baeldung.ehcache.config.CacheHelper;
public class SquaredCalculator {
private CacheHelper cache;

View File

@ -1,4 +1,4 @@
package org.baeldung.ehcache.config;
package com.baeldung.ehcache.config;
import org.ehcache.Cache;
import org.ehcache.CacheManager;

View File

@ -13,7 +13,7 @@
<!-- <context:annotation-config/> -->
<!-- the service that you wish to make cacheable. -->
<bean id="customerDataService" class="org.baeldung.caching.example.CustomerDataService"/>
<bean id="customerDataService" class="com.baeldung.caching.example.CustomerDataService"/>
<bean id="cacheManager" class="org.springframework.cache.support.SimpleCacheManager">
<property name="caches">
@ -34,7 +34,7 @@
<!-- apply the behavior to all the implementations of CustomerDataService -->
<aop:config>
<aop:advisor advice-ref="cachingBehavior" pointcut="execution(* org.baeldung.caching.example.CustomerDataService.*(..))"/>
<aop:advisor advice-ref="cachingBehavior" pointcut="execution(* com.baeldung.caching.example.CustomerDataService.*(..))"/>
</aop:config>
</beans>

View File

@ -1,4 +1,4 @@
package org.baeldung.caching.test;
package com.baeldung.caching.test;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
@ -7,7 +7,7 @@ import static org.junit.Assert.assertThat;
import java.util.ArrayList;
import java.util.List;
import org.baeldung.caching.eviction.service.CachingService;
import com.baeldung.caching.eviction.service.CachingService;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

View File

@ -1,4 +1,4 @@
package org.baeldung.caching.test;
package com.baeldung.caching.test;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
@ -7,7 +7,7 @@ import static org.junit.Assert.assertThat;
import java.util.ArrayList;
import java.util.List;
import org.baeldung.caching.eviction.service.CachingService;
import com.baeldung.caching.eviction.service.CachingService;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

View File

@ -1,9 +1,9 @@
package org.baeldung.caching.test;
package com.baeldung.caching.test;
import org.baeldung.caching.config.CachingConfig;
import org.baeldung.caching.example.Customer;
import org.baeldung.caching.example.CustomerDataService;
import org.baeldung.caching.example.CustomerServiceWithParent;
import com.baeldung.caching.config.CachingConfig;
import com.baeldung.caching.example.Customer;
import com.baeldung.caching.example.CustomerDataService;
import com.baeldung.caching.example.CustomerServiceWithParent;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;

View File

@ -1,7 +1,7 @@
package org.baeldung.ehcache;
package com.baeldung.ehcache;
import org.baeldung.ehcache.calculator.SquaredCalculator;
import org.baeldung.ehcache.config.CacheHelper;
import com.baeldung.ehcache.calculator.SquaredCalculator;
import com.baeldung.ehcache.config.CacheHelper;
import org.junit.Before;
import org.junit.Test;

View File

@ -1,4 +1,4 @@
package org.baeldung.persistence;
package com.baeldung.persistence;
import java.io.Serializable;
import java.util.List;

View File

@ -1,6 +1,6 @@
package org.baeldung.persistence.dao;
package com.baeldung.persistence.dao;
import org.baeldung.persistence.model.Foo;
import com.baeldung.persistence.model.Foo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

View File

@ -1,4 +1,4 @@
package org.baeldung.persistence.model;
package com.baeldung.persistence.model;
import java.io.Serializable;

View File

@ -1,4 +1,4 @@
package org.baeldung.persistence.model;
package com.baeldung.persistence.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;

View File

@ -0,0 +1,10 @@
package com.baeldung.persistence.service;
import com.baeldung.persistence.model.Foo;
import com.baeldung.persistence.IOperations;
public interface IFooService extends IOperations<Foo> {
Foo retrieveByName(String name);
}

View File

@ -1,9 +1,9 @@
package org.baeldung.persistence.service.common;
package com.baeldung.persistence.service.common;
import java.io.Serializable;
import java.util.List;
import org.baeldung.persistence.IOperations;
import com.baeldung.persistence.IOperations;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.transaction.annotation.Transactional;

View File

@ -1,9 +1,9 @@
package org.baeldung.persistence.service.impl;
package com.baeldung.persistence.service.impl;
import org.baeldung.persistence.dao.IFooDao;
import org.baeldung.persistence.model.Foo;
import org.baeldung.persistence.service.IFooService;
import org.baeldung.persistence.service.common.AbstractService;
import com.baeldung.persistence.dao.IFooDao;
import com.baeldung.persistence.model.Foo;
import com.baeldung.persistence.service.IFooService;
import com.baeldung.persistence.service.common.AbstractService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Service;

View File

@ -1,4 +1,4 @@
package org.baeldung.spring;
package com.baeldung.spring;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
@ -19,7 +19,7 @@ import org.springframework.web.context.request.RequestContextListener;
*/
@EnableScheduling
@EnableAutoConfiguration
@ComponentScan("org.baeldung")
@ComponentScan("com.baeldung")
@SpringBootApplication
public class Application extends SpringBootServletInitializer {

View File

@ -1,4 +1,4 @@
package org.baeldung.spring;
package com.baeldung.spring;
import java.util.Properties;
@ -24,9 +24,9 @@ import com.google.common.base.Preconditions;
@Configuration
@EnableTransactionManagement
@PropertySource({ "classpath:persistence-${envTarget:h2}.properties" })
@ComponentScan({ "org.baeldung.persistence" })
@ComponentScan({ "com.baeldung.persistence" })
// @ImportResource("classpath*:springDataPersistenceConfig.xml")
@EnableJpaRepositories(basePackages = "org.baeldung.persistence.dao")
@EnableJpaRepositories(basePackages = "com.baeldung.persistence.dao")
public class PersistenceConfig {
@Autowired
@ -40,7 +40,7 @@ public class PersistenceConfig {
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
em.setDataSource(dataSource());
em.setPackagesToScan(new String[] { "org.baeldung.persistence.model" });
em.setPackagesToScan(new String[] { "com.baeldung.persistence.model" });
final HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
// vendorAdapter.set

View File

@ -1,4 +1,4 @@
package org.baeldung.spring;
package com.baeldung.spring;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
@ -10,7 +10,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.view.InternalResourceViewResolver;
@Configuration
@ComponentScan("org.baeldung.web")
@ComponentScan("com.baeldung.web")
@EnableWebMvc
public class WebConfig implements WebMvcConfigurer {

View File

@ -1,12 +1,12 @@
package org.baeldung.web.controller;
package com.baeldung.web.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.baeldung.persistence.model.Foo;
import org.baeldung.persistence.service.IFooService;
import org.baeldung.web.util.RestPreconditions;
import com.baeldung.persistence.model.Foo;
import com.baeldung.persistence.service.IFooService;
import com.baeldung.web.util.RestPreconditions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;

View File

@ -1,4 +1,4 @@
package org.baeldung.web.controller;
package com.baeldung.web.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

View File

@ -1,9 +1,9 @@
package org.baeldung.web.controller;
package com.baeldung.web.controller;
import java.util.Map;
import org.baeldung.web.metric.IActuatorMetricService;
import org.baeldung.web.metric.IMetricService;
import com.baeldung.web.metric.IActuatorMetricService;
import com.baeldung.web.metric.IMetricService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

View File

@ -1,4 +1,4 @@
package org.baeldung.web.exception;
package com.baeldung.web.exception;
public final class MyResourceNotFoundException extends RuntimeException {

View File

@ -1,4 +1,4 @@
package org.baeldung.web.metric;
package com.baeldung.web.metric;
import java.text.SimpleDateFormat;
import java.util.ArrayList;

View File

@ -1,4 +1,4 @@
package org.baeldung.web.metric;
package com.baeldung.web.metric;
import java.text.SimpleDateFormat;
import java.util.ArrayList;

View File

@ -1,4 +1,4 @@
package org.baeldung.web.metric;
package com.baeldung.web.metric;
public interface IActuatorMetricService {
Object[][] getGraphData();

View File

@ -1,4 +1,4 @@
package org.baeldung.web.metric;
package com.baeldung.web.metric;
public interface ICustomActuatorMetricService {

View File

@ -1,4 +1,4 @@
package org.baeldung.web.metric;
package com.baeldung.web.metric;
import java.util.Map;

View File

@ -1,4 +1,4 @@
package org.baeldung.web.metric;
package com.baeldung.web.metric;
import javax.servlet.Filter;
import javax.servlet.FilterChain;

View File

@ -1,4 +1,4 @@
package org.baeldung.web.metric;
package com.baeldung.web.metric;
import java.text.SimpleDateFormat;
import java.util.Date;

View File

@ -1,9 +1,8 @@
package org.baeldung.web.util;
package com.baeldung.web.util;
import com.baeldung.web.exception.MyResourceNotFoundException;
import org.springframework.http.HttpStatus;
import org.baeldung.web.exception.MyResourceNotFoundException;
/**
* Simple static methods to be called at the start of your own methods to verify correct arguments and state. If the Precondition fails, an {@link HttpStatus} code is thrown
*/

View File

@ -1,10 +0,0 @@
package org.baeldung.persistence.service;
import org.baeldung.persistence.IOperations;
import org.baeldung.persistence.model.Foo;
public interface IFooService extends IOperations<Foo> {
Foo retrieveByName(String name);
}

View File

@ -7,6 +7,6 @@
http://www.springframework.org/schema/data/jpa/spring-jpa.xsd"
>
<jpa:repositories base-package="org.baeldung.persistence.dao"/>
<jpa:repositories base-package="com.baeldung.persistence.dao"/>
</beans>

View File

@ -16,7 +16,7 @@
</context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>org.baeldung.spring</param-value>
<param-value>com.baeldung.spring</param-value>
</context-param>
<listener>
@ -37,7 +37,7 @@
<!-- Metric filter -->
<filter>
<filter-name>metricFilter</filter-name>
<filter-class>org.baeldung.web.metric.MetricFilter</filter-class>
<filter-class>com.baeldung.web.metric.MetricFilter</filter-class>
</filter>
<filter-mapping>

View File

@ -1,4 +1,4 @@
package org.baeldung;
package com.baeldung;
public interface Consts {
int APPLICATION_PORT = 8082;

View File

@ -1,6 +1,6 @@
package org.baeldung;
package com.baeldung;
import org.baeldung.spring.Application;
import com.baeldung.spring.Application;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;

View File

@ -1,6 +1,6 @@
package org.baeldung;
package com.baeldung;
import org.baeldung.spring.Application;
import com.baeldung.spring.Application;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;

View File

@ -1,6 +1,6 @@
package org.baeldung.persistence;
package com.baeldung.persistence;
import org.baeldung.persistence.service.FooServicePersistenceIntegrationTest;
import com.baeldung.persistence.service.FooServicePersistenceIntegrationTest;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;

View File

@ -1,4 +1,4 @@
package org.baeldung.persistence.service;
package com.baeldung.persistence.service;
import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic;
import static org.hamcrest.Matchers.hasItem;
@ -11,9 +11,9 @@ import static org.junit.Assert.assertThat;
import java.io.Serializable;
import java.util.List;
import org.baeldung.persistence.IOperations;
import org.baeldung.persistence.model.Foo;
import org.baeldung.util.IDUtil;
import com.baeldung.util.IDUtil;
import com.baeldung.persistence.IOperations;
import com.baeldung.persistence.model.Foo;
import org.hamcrest.Matchers;
import org.junit.Ignore;
import org.junit.Test;

View File

@ -1,11 +1,11 @@
package org.baeldung.persistence.service;
package com.baeldung.persistence.service;
import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic;
import static org.junit.Assert.assertNotNull;
import org.baeldung.persistence.IOperations;
import org.baeldung.persistence.model.Foo;
import org.baeldung.spring.PersistenceConfig;
import com.baeldung.persistence.IOperations;
import com.baeldung.persistence.model.Foo;
import com.baeldung.spring.PersistenceConfig;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;

View File

@ -1,4 +1,4 @@
package org.baeldung.util;
package com.baeldung.util;
import java.util.Random;

View File

@ -1,4 +1,4 @@
package org.baeldung.shell;
package com.baeldung.shell;
import java.io.IOException;
import org.springframework.shell.Bootstrap;

View File

@ -1,4 +1,4 @@
package org.baeldung.shell.simple;
package com.baeldung.shell.simple;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;

View File

@ -1,4 +1,4 @@
package org.baeldung.shell.simple;
package com.baeldung.shell.simple;
import java.io.BufferedReader;
import java.io.FileNotFoundException;

View File

@ -1,4 +1,4 @@
package org.baeldung.shell.simple;
package com.baeldung.shell.simple;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;

View File

@ -1,4 +1,4 @@
package org.baeldung.shell.simple;
package com.baeldung.shell.simple;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;

View File

@ -1,4 +1,4 @@
package org.baeldung.shell.simple;
package com.baeldung.shell.simple;
import java.net.MalformedURLException;
import java.net.URL;

View File

@ -8,6 +8,6 @@
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.2.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd">
<context:component-scan base-package="org.baeldung.shell.simple"/>
<context:component-scan base-package="com.baeldung.shell.simple"/>
</beans>

View File

@ -1,4 +1,4 @@
package org.baeldung.shell.simple;
package com.baeldung.shell.simple;
import org.junit.AfterClass;
import org.junit.Assert;