java ee - How do I inject CDI beans into custom entity classes? -


We use Cassandra (and the DataStax driver) to store our entities. As we have a custom unit service that makes new instances of our institution classes when it receives data from the cadence

I have to inject the services in my unit sections using the CDI. How do I do this? When I was on injection annotation, never injection.

  public class customer {@ inject private event & lt; Deactivation Program & gt; Arrangement; Private string UID; Public Zero Set (String UID) {this.uid = uid; } Public string getUid () {return.uid; } Public Zero Passive () {events.fire (New DeactivationEvent ()); }} Public CassandraEntityService {Public Static Customer Search Customer (String UID) {... Whatever the argument to see ... customer customer = new customer (); Customer.setUid (..) Clients.Set ... customer back; For reference, I am using JBys / Wildfire 8.1.   

CassandraEntityService.findCustomer () The immediate problem is that clients Example is not a cdi bean, because findCustomer calls the constructor directly.

You may be in trouble using, but I think that (a) you need the Creator method for the customer , and (b) CassandraEntityService

However, for a better solution for more general, one needs another bean, which is @ inject s customer . Problem (Entity changes when firing an event) is likely to be one, in which case Customer will probably not be required to be a CDI bean.


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

c# - NewtonSoft JArray - how to select multiple elements with LINQ -

javascript - amcharts makechart not working -