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

Add "Custom Code Section" in generated code to replace side-by-side implementation #27249

Open
simplicii opened this issue Sep 11, 2024 · 0 comments

Comments

@simplicii
Copy link

Overview of the feature request

This FR is about adding sections inside the generated code for custom code, which will not be overridden by the generator.

Motivation for or Use Case

First generation is nice, buit as soon as you start implementing and changing code, you face the limitations of the generator. As soon as you want to change i.e Repository you face trouble.

Proposed Solution is as follows:

Entities and Repositories should have multiple predefined sections which allow to add custom code.

@Repository
public interface UserRepository extends R2dbcRepository<User, Long>, UserRepositoryInternal {
  
   Mono<User> findOneByActivationKey(String activationKey);
   
   [...]

    //---CUSTOM-CODE-START---
       Mono<User> findMyOwnStuff(Integer shoesize);
    //---CUSTOM-CODE-END---

The same with //---CUSTOM-IMPORT-START--- to provide space for needed imports.

The generator will recognize the sections and just ignore them or reinsert them in the new generated file.

Related issues or PR

Not that I found any similar requests, but a lot of questions about the topic and workaround like side-by-side developement. There are even Tech talks about this.

  • [x ] Checking this box is mandatory (this is just to show you read everything)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant