-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update cosmos nosql connection strategy
- Loading branch information
1 parent
5f1e936
commit b4eb39d
Showing
5 changed files
with
5 additions
and
122 deletions.
There are no files selected for viewing
29 changes: 1 addition & 28 deletions
29
src/main/java/it/gov/pagopa/rtp/activator/configuration/CosmosDBConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,10 @@ | ||
package it.gov.pagopa.rtp.activator.configuration; | ||
|
||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
import com.azure.cosmos.CosmosClientBuilder; | ||
import com.azure.identity.DefaultAzureCredential; | ||
import com.azure.identity.DefaultAzureCredentialBuilder; | ||
import com.azure.spring.data.cosmos.config.AbstractCosmosConfiguration; | ||
import com.azure.spring.data.cosmos.repository.config.EnableReactiveCosmosRepositories; | ||
|
||
@Configuration | ||
@EnableReactiveCosmosRepositories("it.gov.pagopa.rtp.activator.repository") | ||
public class CosmosDBConfig extends AbstractCosmosConfiguration { | ||
|
||
private CosmosPropertiesConfig cosmosPropertiesConfig; | ||
|
||
public CosmosDBConfig(CosmosPropertiesConfig cosmosPropertiesConfig){ | ||
this.cosmosPropertiesConfig = cosmosPropertiesConfig; | ||
} | ||
|
||
@Override | ||
protected String getDatabaseName() { | ||
return cosmosPropertiesConfig.getDatabase(); | ||
} | ||
|
||
@Bean | ||
public CosmosClientBuilder getCosmosClientBuilder() { | ||
DefaultAzureCredential credential = new DefaultAzureCredentialBuilder() | ||
.build(); | ||
|
||
return new CosmosClientBuilder() | ||
.endpoint(cosmosPropertiesConfig.getUri()) | ||
.credential(credential); | ||
} | ||
|
||
public class CosmosDBConfig { | ||
} |
19 changes: 0 additions & 19 deletions
19
src/main/java/it/gov/pagopa/rtp/activator/configuration/CosmosPropertiesConfig.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 0 additions & 44 deletions
44
src/test/java/it/gov/pagopa/rtp/activator/configuration/CosmosDBConfigTest.java
This file was deleted.
Oops, something went wrong.
28 changes: 0 additions & 28 deletions
28
src/test/java/it/gov/pagopa/rtp/activator/configuration/CosmosPropertiesConfigTest.java
This file was deleted.
Oops, something went wrong.