Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Datastore: spring-native support #1279

Open
dosomder opened this issue Oct 6, 2022 · 5 comments
Open

Datastore: spring-native support #1279

dosomder opened this issue Oct 6, 2022 · 5 comments

Comments

@dosomder
Copy link

dosomder commented Oct 6, 2022

Is there any support for spring-native when using datastore and its DatastoreRepository?

I have declared my repository like this:

public interface CategoryRepository extends DatastoreRepository<Category, Long> {
}

Then I have another class that uses the repo:

@Component
public class Gateway {
  @Autowired
  private CategoryRepository categoryRepository;
  ......
}

While the project builds using spring-native, on start up I get the following exception:

***************************
APPLICATION FAILED TO START
***************************

Description:

Field categoryRepository in ch.do.storage.repo.Gateway required a bean of type 'ch.do.storage.repo.CategoryRepository' that could not be found.

The injection point has the following annotations:
        - @org.springframework.beans.factory.annotation.Autowired(required=true)


Action:

Consider defining a bean of type 'ch.do.storage.repo.CategoryRepository' in your configuration.

In the file build/generated/resources/aotMain/MAIN-INF/spring.components, there is the following entry:

ch.do.storage.repo.CategoryRepository=org.springframework.data.repository.Repository

Is there some kind of additional configuration needed (like NativeHint)? How would it look like?

@JoeWang1127
Copy link
Contributor

Hi @dosomder, sorry but we don't support spring-native way using datastore.

@elefeint
Copy link
Contributor

elefeint commented Oct 6, 2022

You can try to add spring native dependency, which would likely take care of Spring-specific annotations/reflection. But we have not tested these projects with native at this point.

@dosomder
Copy link
Author

dosomder commented Oct 9, 2022

Hi @elefeint

I am using spring-native and the supported spring-boot version, still the exception from the first post appears

@elefeint
Copy link
Contributor

Thanks for confirming! We have plans to look into native compilation compatibility after Spring Boot 3.0 comes out, but it definitely won't be supported until 2023.

@dosomder
Copy link
Author

Cool, looking forward to it because the start up time at the moment is really bad

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants