-
-
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.
feat(core): Relationships auto-configuration
- Loading branch information
Showing
5 changed files
with
51 additions
and
13 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
...main/java/io/github/joselion/springr2dbcrelationships/RelationshipsAutoConfiguration.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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package io.github.joselion.springr2dbcrelationships; | ||
|
||
import org.springframework.context.ApplicationContext; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.Lazy; | ||
import org.springframework.data.r2dbc.core.R2dbcEntityTemplate; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
|
||
/** | ||
* Relationships autoconfiguration. | ||
*/ | ||
@Slf4j | ||
@Configuration | ||
public class RelationshipsAutoConfiguration { | ||
|
||
/** | ||
* Default configuration constructor. | ||
*/ | ||
protected RelationshipsAutoConfiguration() { | ||
log.info("R2DBC Relationships auto-configuration loaded."); | ||
} | ||
|
||
/** | ||
* Creates the {@link RelationshipsCallbacks} bean. | ||
* | ||
* @param <T> the type of the entity in the callback | ||
* @param template the r2dbc entity template | ||
* @param context the Spring application context | ||
* @return the relationship callbacks bean | ||
*/ | ||
@Bean | ||
public <T> RelationshipsCallbacks<T> relationshipsCallbacks( | ||
final @Lazy R2dbcEntityTemplate template, | ||
final @Lazy ApplicationContext context | ||
) { | ||
return new RelationshipsCallbacks<>(template, context); | ||
} | ||
} |
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
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
1 change: 1 addition & 0 deletions
1
...esources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
io.github.joselion.springr2dbcrelationships.RelationshipAutoConfiguration |
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