xmolecules / jmolecules-integrations Goto Github PK
View Code? Open in Web Editor NEWTechnology integration for jMolecules
License: Apache License 2.0
Technology integration for jMolecules
License: Apache License 2.0
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:
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
}
}
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;
}
}
./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)`
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
.
Waiting for spring-projects/spring-data-commons#2315.
@DomainEventHandler
into @EventListener
and backAssociation
s 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 Converter
s 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.
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.
Adds support for plugin auto-discovery to reduce the amount of configuration needed for the jMolecules ByteBuddy plugin.
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.
This shouldn't affect actual production projects but the tests currently cannot properly test for the addition of all annotations as we need to use slightly different code to accumulate multiple annotations on fields (see raphw/byte-buddy#1022 for details).
@MappedSuperclass
applied.A pool for Converter
implementations, prepared configuration and potential Spring Boot auto configuration.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.