GoogleCloudPlatform / GoogleCloudPlatform/spring-cloud-gcp

Datastore: spring-native support

Open
#1,279 5 comments 0 reactions 0 assignees View on GitHub
datastore priority: p3 type: enhancement
Dominant language
Java
Stars
551
Forks
349
Avg merge
1d 13h
Merged PRs (30d)
14

Description

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 {
}
```

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?

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the startup failure with the shown CategoryRepository and inspect build/generated/resources/aotMain/MAIN-INF/spring.components. Investigate how Spring Native AOT handles DatastoreRepository and whether NativeHint configuration is involved. Done means identifying the compatibility issue and documenting or implementing the required configuration, with the failing startup scenario verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
backend, cloud, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.