[
https://issues.apache.org/jira/browse/IGNITE-13029?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17273311#comment-17273311
]
Alexey Plotnik commented on IGNITE-13029:
-----------------------------------------
[~dmagda] [~sdanilov] please find my concerns below, maybe this is not an issue
and should not be fixed.
In SpringBoot discovery of repository classes works the same way as in Spring,
you attach it to main class:
{code}
@SpringBootApplication
@EnableIgniteRepositories
public class SpringBootApp {}
{code}
Then Spring Data looks for repositories in package where SpringBootApp located.
There is no reason to move @EnableIgniteRepositories somewhere else like to
external IgniteSpringAutoConfiguration in {{spring-boot-autoconfigure-ext}},
because *configuration becomes more difficult*. The puprose of this annotation
is to be inside user application and to be controlled by user.
*Motivation why there is no reason to move @EnableIgniteRepositories to
external library:*
When configuration class with attached @EnableIgniteRepositories is located in
external package you MUST explicity provide at least {{basePackages}} parameter
to give spring data starting point where looking for repository classes:
{code}
@SpringBootApplication
@EnableIgniteRepositories(basePackages = "???")
public class SpringBootApp {}
{code}
When not provided repositories are scanned inside package where class with
@EnableIgniteRepositories is located (org.ignite.*) which is wrong. So we must
somehove provide this information to external lib.
We of course can parametrize this parameter in external
IgniteDataSpringBootAutoConfiguration like this:
{code}
@ConditionalOnClass(EnableIgniteRepositories.class)
@Configuration
@EnableIgniteRepositories(
basePackages = "${ignite.spring.data.repository.enable.basePackages}"
)
public class IgniteDataSpringBoot22AutoConfiguration {
}
{code}
But then user MUST always specify this parameter when linking library, there is
no default value, like this:
{{application.yml}}:
{code}
ignite:
spring:
data:
repository:
enable:
basePackages: "my.app.ignite"
{code}
This way looks dirty and not flexible. Even more, Data Cassandra and Data Mongo
don't do this, letting user to attach @EnableRepositoryes annotation by himself
and provide all the parameters to it manually when needed. I guess this is
because @EnableRepositoryes was designed to be a part of application.
> 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)