-
-
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
3 changed files
with
43 additions
and
5 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
src/main/java/io/github/joselion/springr2dbcrelationships/RelationshipAutoConfiguration.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 RelationshipAutoConfiguration { | ||
|
||
/** | ||
* Default configuration constructor. | ||
*/ | ||
protected RelationshipAutoConfiguration() { | ||
log.info("R2DBC Relationships auto-configuration loaded."); | ||
} | ||
|
||
/** | ||
* Creates the {@link RelationshipCallbacks} 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> RelationshipCallbacks<T> relationshipCallbacks( | ||
final @Lazy R2dbcEntityTemplate template, | ||
final @Lazy ApplicationContext context | ||
) { | ||
return new RelationshipCallbacks<>(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
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 |