Giter VIP home page Giter VIP logo

jmolecules-integrations's People

Contributors

haisi avatar odrotbohm avatar rweisleder avatar tedyoung avatar tjuerge avatar zambrovski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jmolecules-integrations's Issues

Implement Persistable with AggregateRoots

Implementations of AggregateRoot need to implement an ID getId() for ID being typed to Identifier. Those identifiers will not be auto generated because it is good practice to model entities to early expose their proper identity without having to be persisted in the first place.

In the context of Spring Data this means that AggregateRoot instances actually have to implement Persistable and keep a flag around to track the is-new state for the instance that's then flipped by lifecycle callback methods of the particular store, like @PrePersist and @PostLoad in JPA.

The ByteBuddy plugin could provide that implementation so that users don't have to add this boilerplate code.

Add Jackson integration for value objects and identifiers

Single-attribute value types and identifiers should be rendered as their embedded value:

@Value(staticConstructor = "of")
class SampleIdentifier implements Identifier {
  UUID uuid;
}

should render as the UUID would render. Reversely, SampleIdentifier instances should be able to be constructed from a UUID / String.

Register JPA AttributeConverter for Associations

Associations currently require an explicit implementation class to be used with JPA annotated with @Embeddable. We could provide an AttributeConverter implementation that uses the already existing Spring Converters to translate from Association into the identifier primitive and back.

The actual class can be generated by the ByteBuddy plugin and registered via an @Convert annotation on the association field.

Add Spring runtime library

A pool for Converter implementations, prepared configuration and potential Spring Boot auto configuration.

Spring integration: Fails to generate a repository bean

Hello!

When configured with the spring buddy-byte integration, is there an expectation that interfaces which extend org.jmolecules.ddd.types.Repository should be registered as beans in the spring context?

I've got a sample repo configured demonstrating this error here. The spring context doesn't see any repo beans

2021-05-01 11:39:59.103  INFO 23848 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2021-05-01 11:39:59.114  INFO 23848 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 5 ms. Found 0 JPA repository interfaces.

I also tried to annotate that Posts repository with the spring @Repository stereotype and it didn't find it either.

Gradle build fails to generate a Persistable

Hello there! I ran into a problem trying to get jmolecules bytebuddy working with gradle. It seems this line is to blame https://github.com/xmolecules/jmolecules-integrations/blob/main/jmolecules-bytebuddy/src/main/java/org/jmolecules/bytebuddy/PersistableImplementor.java#L142. The target directory is a maven specific output dir and gradle projects won't have them.

Steps to reproduce:

  1. Generated a spring app using gradle
  2. Added the following as the configuration for jmolecules at the top of the build.gradle:
    buildscript {
        dependencies {
    	    classpath platform('org.jmolecules:jmolecules-bom:2021.0.1')
    	    classpath 'org.jmolecules.integrations:jmolecules-spring'
    	    classpath 'org.jmolecules.integrations:jmolecules-jpa'
    	    classpath 'org.jmolecules.integrations:jmolecules-bytebuddy'
        }
    }
    plugins {
        id 'java'
        id 'org.springframework.boot' version '2.4.5'
        id 'io.spring.dependency-management' version '1.0.11.RELEASE'
        id 'net.bytebuddy.byte-buddy-gradle-plugin' version '1.11.0'
    }
    
    byteBuddy {
        transformation {
    	    plugin = org.jmolecules.bytebuddy.JMoleculesPlugin
        }
    }
  3. Add an aggregate root
    package com.example.demo;
    
    import lombok.Getter;
    import lombok.Value;
    import org.jmolecules.ddd.types.AggregateRoot;
    import org.jmolecules.ddd.types.Identifier;
    
    import java.util.UUID;
    
    @Getter
    public class Post implements AggregateRoot<Post, Post.PostId> {
        private final PostId id;
    
        public Post() {
            id = PostId.of(UUID.randomUUID());
        }
    
        @Value(staticConstructor = "of")
        public static class PostId implements Identifier {
            UUID id;
        }
    }
  4. Ran ./gradlew assemble

Got the following error:

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':byteBuddy'.
...
Caused by: java.lang.IllegalStateException: {class com.example.demo.Post=[java.lang.IllegalArgumentException: Could not create directory: target/classes/com/example/demo]} type transformations have failed
	at net.bytebuddy.build.gradle.AbstractByteBuddyTask.doApply(AbstractByteBuddyTask.java:404)
	at net.bytebuddy.build.gradle.ByteBuddyTask.apply(ByteBuddyTask.java:133)`

Upgrade to ByteBuddy 1.10.20

Adds support for plugin auto-discovery to reduce the amount of configuration needed for the jMolecules ByteBuddy plugin.

Advanced Spring annotation generation

  • translate jMolecules annotations into Spring Framework ones and back
  • translate the newly introduced @DomainEventHandler into @EventListener and back

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.