You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Alexey Plotnik (Jira)" <ji...@apache.org> on 2021/01/26 05:15:00 UTC

[jira] [Commented] (IGNITE-13029) Support Spring Data repositories initialization with Spring Boot auto-starter

    [ https://issues.apache.org/jira/browse/IGNITE-13029?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17271879#comment-17271879 ] 

Alexey Plotnik commented on IGNITE-13029:
-----------------------------------------

Default way to enable repositories is to assing @EnableIgniteRepositories to Spring Configuration, basically adding a single line of code.

When using Spring Boot we are forced to use {{spring-boot-autoconfigure-ext}} artifact, its purpose to initialize Ignite instance. Important: this module knows nothing about spring-data at all, it's just an ignite core specific auto-configurer. I guess it's not correct to add @EnableIgniteRepositories to org.apache.ignite.springframework.boot.autoconfigure.IgniteAutoConfiguration

Another way is to create standalone artifact, i.e. {{spring-boot-starter-data-ignite}}, an autoconfig class will look like this:

{code}
@EnableIgniteRepositories
public class IgniteDataAutoConfiguration {
}
{code}

The issue here is that by default spring data will be looking for Repository classes in packages described in {{basePackages}} parameter of annotation, so it expect something like:

{code}
@EnableIgniteRepositories(basePackages = "com.gridgain.investigate")
public class IgniteDataAutoConfiguration {

}
{code}

If base package is not defined, the one where internal auto-configuration class of {{spring-boot-autoconfigure-ext}} located will be used (org.apache.ignite.springframework.boot.data.autoconfigure) which is wrong. To avoid that behaviour we must somehown parametrize basePackages value and provide correct packages from user application.


It looks like there are too many steps to just move @EnableIgniteRepositories from regular spring configuration to auto-configuration.

Could anyone talk to me about motivation of this improvement?



> Support Spring Data repositories initialization with Spring Boot auto-starter
> -----------------------------------------------------------------------------
>
>                 Key: IGNITE-13029
>                 URL: https://issues.apache.org/jira/browse/IGNITE-13029
>             Project: Ignite
>          Issue Type: Improvement
>          Components: spring, springdata
>    Affects Versions: 2.8
>            Reporter: Denis A. Magda
>            Assignee: Alexey Plotnik
>            Priority: Major
>              Labels: newbie
>
> It's required to use {{@EnableIgniteRepositories}} annotation and follow this procedure to enable Ignite Spring Data repositories:
> https://apacheignite-mix.readme.io/docs/spring-data#spring-data-and-apache-ignite-configuration
> Support the Spring Data repositories enablement via the Spring Boot auto-starter if Spring Boot is used by a project:
> https://apacheignite-mix.readme.io/docs/spring-boot



--
This message was sent by Atlassian Jira
(v8.3.4#803005)