cleaned up module spring-data-jpa
This commit is contained in:
@@ -5,7 +5,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||
|
||||
import com.baeldung.boot.daos.impl.ExtendedRepositoryImpl;
|
||||
import com.baeldung.multipledb.MultipleDbApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableJpaRepositories(repositoryBaseClass = ExtendedRepositoryImpl.class)
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package com.baeldung.boot.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
import com.baeldung.boot.services.IBarService;
|
||||
import com.baeldung.boot.services.impl.BarSpringDataJpaService;
|
||||
import org.springframework.context.annotation.*;
|
||||
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
|
||||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
@Configuration
|
||||
@Profile("!tc")
|
||||
|
||||
@@ -2,8 +2,6 @@ package com.baeldung.boot.daos.impl;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@@ -13,8 +11,6 @@ import com.baeldung.boot.domain.ItemType;
|
||||
@Repository
|
||||
public class CustomItemTypeRepositoryImpl implements CustomItemTypeRepository {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(CustomItemTypeRepositoryImpl.class);
|
||||
|
||||
@Autowired
|
||||
private EntityManager entityManager;
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ public abstract class AbstractService<T extends Serializable> implements IOperat
|
||||
|
||||
@Override
|
||||
public Page<T> findPaginated(final int page, final int size) {
|
||||
return getDao().findAll(new PageRequest(page, size));
|
||||
return getDao().findAll(PageRequest.of(page, size));
|
||||
}
|
||||
|
||||
// write
|
||||
|
||||
@@ -1,24 +1,19 @@
|
||||
package com.baeldung.boot.daos;
|
||||
|
||||
import com.baeldung.boot.Application;
|
||||
import com.baeldung.boot.config.PersistenceConfiguration;
|
||||
import com.baeldung.boot.daos.ArticleRepository;
|
||||
import com.baeldung.boot.domain.Article;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import com.baeldung.boot.domain.Article;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@DataJpaTest(properties="spring.datasource.data=classpath:import_entities.sql")
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package com.baeldung.boot.daos;
|
||||
|
||||
import com.baeldung.boot.Application;
|
||||
import com.baeldung.boot.config.PersistenceConfiguration;
|
||||
import com.baeldung.boot.daos.ExtendedStudentRepository;
|
||||
import com.baeldung.boot.domain.Student;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@@ -12,10 +13,8 @@ import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import com.baeldung.boot.Application;
|
||||
import com.baeldung.boot.domain.Student;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration(classes = {Application.class})
|
||||
|
||||
@@ -1,23 +1,20 @@
|
||||
package com.baeldung.boot.daos;
|
||||
|
||||
import com.baeldung.boot.Application;
|
||||
import com.baeldung.boot.config.PersistenceConfiguration;
|
||||
import com.baeldung.boot.daos.InventoryRepository;
|
||||
import com.baeldung.boot.domain.MerchandiseEntity;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import com.baeldung.boot.Application;
|
||||
import com.baeldung.boot.domain.MerchandiseEntity;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes=Application.class)
|
||||
public class InventoryRepositoryIntegrationTest {
|
||||
|
||||
@@ -13,21 +13,12 @@ import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import com.baeldung.boot.Application;
|
||||
import com.baeldung.boot.config.PersistenceConfiguration;
|
||||
import com.baeldung.boot.daos.ItemTypeRepository;
|
||||
import com.baeldung.boot.daos.LocationRepository;
|
||||
import com.baeldung.boot.daos.ReadOnlyLocationRepository;
|
||||
import com.baeldung.boot.daos.StoreRepository;
|
||||
import com.baeldung.boot.domain.Item;
|
||||
import com.baeldung.boot.domain.ItemType;
|
||||
import com.baeldung.boot.domain.Location;
|
||||
import com.baeldung.boot.domain.Store;
|
||||
import com.baeldung.multipledb.PersistenceProductConfiguration;
|
||||
import com.baeldung.multipledb.PersistenceUserConfiguration;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@DataJpaTest(properties="spring.datasource.data=classpath:import_entities.sql")
|
||||
|
||||
@@ -25,7 +25,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
public class UserRepositoryTCAutoLiveTest extends UserRepositoryCommon {
|
||||
|
||||
@ClassRule
|
||||
public static PostgreSQLContainer postgreSQLContainer = BaeldungPostgresqlContainer.getInstance();
|
||||
public static PostgreSQLContainer<BaeldungPostgresqlContainer> postgreSQLContainer = BaeldungPostgresqlContainer.getInstance();
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
package com.baeldung.boot.services;
|
||||
|
||||
import com.baeldung.boot.Application;
|
||||
import com.baeldung.boot.config.PersistenceConfiguration;
|
||||
import com.baeldung.boot.domain.Foo;
|
||||
import com.baeldung.boot.services.IFooService;
|
||||
import com.baeldung.boot.services.IOperations;
|
||||
import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
@@ -13,12 +10,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.dao.DataIntegrityViolationException;
|
||||
import org.springframework.dao.InvalidDataAccessApiUsageException;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.test.context.support.AnnotationConfigContextLoader;
|
||||
|
||||
import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import com.baeldung.boot.Application;
|
||||
import com.baeldung.boot.domain.Foo;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes=Application.class)
|
||||
|
||||
@@ -18,14 +18,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.security.test.context.support.WithMockUser;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.test.context.support.AnnotationConfigContextLoader;
|
||||
|
||||
import com.baeldung.boot.Application;
|
||||
import com.baeldung.boot.config.PersistenceConfiguration;
|
||||
import com.baeldung.boot.domain.Bar;
|
||||
import com.baeldung.boot.services.IBarService;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes=Application.class)
|
||||
|
||||
Reference in New Issue
Block a user