Merge pull request #8286 from alimate/BAEL-3334-2

Modularizing the Spring Data JPA 4 Module!
This commit is contained in:
Sam Millington 2019-12-04 07:27:26 +00:00 committed by GitHub
commit b9582651fb
16 changed files with 82 additions and 49 deletions

View File

@ -1,17 +0,0 @@
package com.baeldung;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
@SpringBootApplication
@EnableJpaRepositories
@EntityScan
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}

View File

@ -0,0 +1,13 @@
package com.baeldung.derivedquery;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class QueryApplication {
public static void main(String[] args) {
SpringApplication.run(QueryApplication.class, args);
}
}

View File

@ -0,0 +1,13 @@
package com.baeldung.like;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class LikeApplication {
public static void main(String[] args) {
SpringApplication.run(LikeApplication.class, args);
}
}

View File

@ -0,0 +1,13 @@
package com.baeldung.osiv;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class OsivApplication {
public static void main(String[] args) {
SpringApplication.run(OsivApplication.class, args);
}
}

View File

@ -1,4 +1,4 @@
package com.baeldung.model;
package com.baeldung.osiv.model;
import javax.persistence.*;
import java.util.Set;

View File

@ -1,4 +1,4 @@
package com.baeldung.repository;
package com.baeldung.osiv.repository;
import java.util.Optional;
@ -7,7 +7,7 @@ import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import com.baeldung.model.BasicUser;
import com.baeldung.osiv.model.BasicUser;
@Repository
@Transactional

View File

@ -1,12 +1,12 @@
package com.baeldung.service;
package com.baeldung.osiv.service;
import java.util.Optional;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.baeldung.model.BasicUser;
import com.baeldung.repository.BasicUserRepository;
import com.baeldung.osiv.model.BasicUser;
import com.baeldung.osiv.repository.BasicUserRepository;
@Service
public class SimpleUserService implements UserService {

View File

@ -1,6 +1,6 @@
package com.baeldung.service;
package com.baeldung.osiv.service;
import com.baeldung.model.BasicUser;
import com.baeldung.osiv.model.BasicUser;
import java.util.Optional;

View File

@ -1,6 +1,6 @@
package com.baeldung.web;
package com.baeldung.osiv.web;
import com.baeldung.model.BasicUser;
import com.baeldung.osiv.model.BasicUser;
import java.util.Set;

View File

@ -1,6 +1,6 @@
package com.baeldung.web;
package com.baeldung.osiv.web;
import com.baeldung.service.UserService;
import com.baeldung.osiv.service.UserService;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

View File

@ -0,0 +1,13 @@
package com.baeldung.tx;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class TxApplication {
public static void main(String[] args) {
SpringApplication.run(TxApplication.class, args);
}
}

View File

@ -1,4 +1,4 @@
package com.baeldung.model;
package com.baeldung.tx.model;
import javax.persistence.*;

View File

@ -1,11 +1,7 @@
package com.baeldung.derivedquery.repository;
import com.baeldung.Application;
import com.baeldung.derivedquery.QueryApplication;
import com.baeldung.derivedquery.entity.User;
import com.baeldung.derivedquery.repository.UserRepository;
import java.time.ZonedDateTime;
import java.util.Arrays;
import java.util.List;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@ -14,10 +10,14 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.time.ZonedDateTime;
import java.util.Arrays;
import java.util.List;
import static org.junit.Assert.assertEquals;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)
@SpringBootTest(classes = QueryApplication.class)
public class UserRepositoryIntegrationTest {
private static final String USER_NAME_ADAM = "Adam";

View File

@ -1,10 +1,7 @@
package com.baeldung.like;
import static org.junit.Assert.assertEquals;
import static org.springframework.test.context.jdbc.Sql.ExecutionPhase.AFTER_TEST_METHOD;
import java.util.List;
import com.baeldung.like.model.Movie;
import com.baeldung.like.repository.MovieRepository;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
@ -12,12 +9,14 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.jdbc.Sql;
import org.springframework.test.context.junit4.SpringRunner;
import com.baeldung.like.model.Movie;
import com.baeldung.like.repository.MovieRepository;
import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.springframework.test.context.jdbc.Sql.ExecutionPhase.AFTER_TEST_METHOD;
@RunWith(SpringRunner.class)
@SpringBootTest
@Sql(scripts = { "/test-movie-data.sql" })
@SpringBootTest(classes = LikeApplication.class)
@Sql(scripts = "/test-movie-cleanup.sql", executionPhase = AFTER_TEST_METHOD)
public class MovieRepositoryIntegrationTest {
@Autowired

View File

@ -1,8 +1,7 @@
package com.baeldung.osiv;
import com.baeldung.Application;
import com.baeldung.model.BasicUser;
import com.baeldung.repository.BasicUserRepository;
import com.baeldung.osiv.model.BasicUser;
import com.baeldung.osiv.repository.BasicUserRepository;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@ -23,8 +22,8 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
@SpringBootTest
@AutoConfigureMockMvc
@ContextConfiguration(classes = Application.class)
@ActiveProfiles("test")
@ContextConfiguration(classes = OsivApplication.class)
class UserControllerIntegrationTest {
@Autowired

View File

@ -1,6 +1,6 @@
package com.baeldung.tx;
import com.baeldung.model.Payment;
import com.baeldung.tx.model.Payment;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;