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

jMolecules and ByteBuddy Support with IntelliJ IDEA #150

Open
bekaChichua opened this issue Nov 30, 2024 · 0 comments
Open

jMolecules and ByteBuddy Support with IntelliJ IDEA #150

bekaChichua opened this issue Nov 30, 2024 · 0 comments

Comments

@bekaChichua
Copy link

I am experiencing several issues when working with the jMolecules framework in IntelliJ IDEA. These issues affect both application runtime and development experience in the IDE:

1. Run Configuration Issue:

  • The application fails to start unless I manually configure a “Before Launch” task in the IntelliJ run configuration to execute mvn compile. I’m unsure if I’m misconfiguring something or if this feature is not yet fully implemented. I was unable to find any relevant information about this online.

2. ByteBuddy Code Generation:

  • Even after configuring the “Before Launch” task, ByteBuddy fails to generate the required code for transforming associations into associated aggregate IDs. This leads to runtime failures when saving or retrieving aggregates using Spring Data JDBC. Is ByteBuddy supposed to generate this converter, or should I implement a custom converter?
  • I ask because I noticed the existence of AssociationResolver, and it seems its purpose is to create such a converter. However, in my project, it fails to do so. Here’s an example:

@Getter
@table("test_order")
public class Order implements AggregateRoot<Order, OrderId> {
private final OrderId id;
private final Association<Customer, Customer.CustomerId> customer;

// If I use this constructor, JDBC will not be able to convert UUID into CustomerId without a custom converter
public Order(OrderId id, Association<Customer, Customer.CustomerId> customer) {
    this.id = id;
    this.customer = customer;
}

public Order(OrderId id, UUID customer) {
    this.id = id;
    this.customer = Association.forId(new Customer.CustomerId(customer));
}

public static Order of(Customer customer) {
    return new Order(new OrderId(UUID.randomUUID()), customer.getId().id());
}

public record OrderId(UUID id) implements Identifier {
}

}

3. IDE Warnings:

  • IntelliJ still incorrectly flags errors or warnings in the code. For example, during dependency injection, it shows: "Could not autowire. No beans of 'OrderService' type found. " This happens even when I configure the “Before Launch” task in the run configuration and ByteBuddy generates the necessary beans and application actually works.

Here is my repo: https://github.com/bekaChichua/jmolecules-example

If I’m missing something, please provide resources or guidance on how to resolve these IntelliJ-specific issues. Alternatively, if there are any workarounds you can suggest, I would greatly appreciate it. I’ve spent a lot of time searching for solutions, but there doesn’t seem to be much documentation available, likely because this project is relatively new.

Thank you for your help!

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

No branches or pull requests

1 participant