Replies: 2 comments
-
Use case is: elide model should expose the data from the properties file ( application.yml file). |
Beta Was this translation helpful? Give feedback.
0 replies
-
Your best bet is to create your own DataStore. You can look at the ConfigDataStore for inspiration. It is similar in that in reads & writes to a configuration file. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a model "DeliveryTerms" which does not interacts with any database, using noop datasource that configured in the application start up.
@SpringBootApplication
@EntityScan
public class APIServerApplication extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(APIServerApplication .class, args);
}
}
Model example is: DeliveryTerms.java
@include(name = "delivery-terms")
@Getter
@Setter
@LifeCycleHookBinding(operation = READ, phase = PRESECURITY, hook = DeliveryTermsService.class)
public class DeliveryTerms implements Serializable {
@id
private String id;
}
LifeCycleHookBinding has wired with custome service class "DeliveryTermsService.class" which reads data from the properties and sets the DeliveryTerms
fields code and name.
DeliveryTermsService.java
@component
public class DeliveryTermsService extends EmptyService {
}
application.yml has
deliveryterms: >
ABC - I am at Place,
DEF - Come to my Place,
GHI - Where are you,
KLM - Another property sample
I would like to the json api response as follows:
{ "data": [ { "type": "delivery-terms", "id": 1, "attributes": { "name" : "I am at Place", "code" : "ABC" } }, { "type": "delivery-terms", "id": 2, "attributes": { "name" : "Come to my Place" "code" : "DEF" } } {...} ] }
Problem: With the above code implementation using noop datastore it breaks the json api response and returns only one data element rather than collection of data elements. If I am going to implement JPA entity model, the JSON api response is as above.
Can you please suggest me the solution to return the json api response similar to JPA entity models response? (json api response example is as above).
Beta Was this translation helpful? Give feedback.
All reactions