spring-projects / spring-projects/spring-data-rest

Provide a pom to allow maven builds

Open
#81 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage
Dominant language
Java
Stars
958
Forks
568
PR merge metrics
No merged PRs in 30d

Description

Bit of a long one this so bare with me.

We're currently using spring-data-rest 1.0.0.RELEASE

In our corporate environment, we have issues with using gradle via a proxy. See the following issue:

http://forums.gradle.org/gradle/topics/proxy_error-1r4f6

There doesnt appear to be a resolution to this, therefore we cant build spring-data-rest from source.

We're looking to build 1.1.0.M1 due the issues with Hibernate method level annotations as noted here:

https://github.com/SpringSource/spring-data-rest/issues/33
https://github.com/SpringSource/spring-data-rest/pull/56

The pull issue 56 mentions that fixes to the spring-data-commons and spring-data-jpa:

https://jira.springsource.org/browse/DATACMNS-269
https://jira.springsource.org/browse/DATAJPA-283

should fix this. To quote olivergierke:

"We've introduced the necessary changes in Spring Data Commons and JPA. The method annotations should now be discovered automatically without any need for changes in Spring Data REST."

However, when upgrading to these versions, there's still an issue with spring-data-rest 1.0.0.RELEASE, looking at the JpaEntityMetadata class:

https://github.com/SpringSource/spring-data-rest/blob/1.0.0.RELEASE/spring-data-rest-repository/src/main/java/org/springframework/data/rest/repository/jpa/JpaEntityMetadata.java

From line 42:

for(Attribute attr : entityType.getAttributes()) {
boolean exported = true;
Field field = ReflectionUtils.findField(type, attr.getJavaMember().getName());
if(null == field) {
continue;
}

The line attr.getJavaMember().getName() returns the getter method as a member rather than the field (i.e. if my entity attribute is "name" this returns "getName").

The resultant call to ReflectionUtils.findField will always return null, as it is looking for a method name rather than a field name.

Because I cant build spring-data-rest 1.1.0.M1, and a build is not available in any public repos yet, my only option is to do an ugly hack to the ReflectionUtils in the springframework-core to check for methods as well as fields.

I'm open to any other work arounds or suggestions.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting the repository's existing Gradle build and the requested Maven build requirements; the issue does not name a pom location or required targets. Review spring-data-rest-repository/src/main/java/org/springframework/data/rest/repository/jpa/JpaEntityMetadata.java for the referenced dependency context. Done means the project can be built with Maven in the stated corporate environment.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
build-system
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.