BAEL-3777: Cleanup

This commit is contained in:
Sorin Zamfir 2020-02-01 13:02:43 +02:00
parent ef3570baaf
commit 92640684d8
4 changed files with 10 additions and 9 deletions

View File

@ -5,8 +5,6 @@ import java.util.UUID;
import org.springframework.data.cassandra.repository.CassandraRepository; import org.springframework.data.cassandra.repository.CassandraRepository;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import com.baeldung.dddhexagonalspring.domain.Order;
@Repository @Repository
public interface SpringDataCassandraOrderRepository extends CassandraRepository<OrderEntity, UUID>{ public interface SpringDataCassandraOrderRepository extends CassandraRepository<OrderEntity, UUID>{

View File

@ -1,14 +1,14 @@
package com.baeldung.dddhexagonalspring.infrastracture.repository.mongo; package com.baeldung.dddhexagonalspring.infrastracture.repository.mongo;
import com.baeldung.dddhexagonalspring.domain.Order;
import com.baeldung.dddhexagonalspring.domain.repository.OrderRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;
import java.util.Optional; import java.util.Optional;
import java.util.UUID; import java.util.UUID;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.baeldung.dddhexagonalspring.domain.Order;
import com.baeldung.dddhexagonalspring.domain.repository.OrderRepository;
@Component @Component
public class MongoDbOrderRepository implements OrderRepository { public class MongoDbOrderRepository implements OrderRepository {

View File

@ -1,3 +1,4 @@
spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
spring.data.mongodb.host=localhost spring.data.mongodb.host=localhost
spring.data.mongodb.port=27017 spring.data.mongodb.port=27017
spring.data.mongodb.database=order-database spring.data.mongodb.database=order-database

View File

@ -4,4 +4,6 @@ To run this project, follow these steps:
* Run the application database by executing `docker-compose up` in this directory. * Run the application database by executing `docker-compose up` in this directory.
* Launch the Spring Boot Application (DomainLayerApplication). * Launch the Spring Boot Application (DomainLayerApplication).
* By default, application will connect to this database (configuration in *ddd-layers.properties*) * By default, the application will connect to the one of the two databases (configuration in *ddd-layers.properties*)
* check `CassandraDbOrderRepository.java` and `MongoDbOrderRepository.java`
* switch between the databases by making one of the above beans primary using the `@Primary` annotation