-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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 customFields to InitializrConfiguration #1580
base: main
Are you sure you want to change the base?
Conversation
@JoarVarpe Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
@JoarVarpe Thank you for signing the Contributor License Agreement! |
Hello! This feature essentially tunnels the data from the config file over the What is your use case for this? |
Hi! In our company we are using a custom initializr to create projects and provide example code for usage, and has immensely increased the userfriendliness of our project generation. Due to company policies and security requirements we use our own libraries in addition to several other dependencies and would like to be able to arrange the dependencies, in different packages that the user can select for convenient development and quick setup. This has proved a challenge as it stands now, and the current solution requires band-aid solutions of duplicating code, and the logic supporting selection of packages has to be done in the front-end instead of the back-end, which overall is an unsatisfying solution. In addition to this we have platform related variables that we would like to be able to send to the frontend for potential selection and use in generation in the backend, this too currently needs duplication of variables instead of being able to send the data and use it in the frontend. In the case that the solution provided is not an option, a better way of achieving this functionality would be greatly appreciated, as we really do like the initializr and wish to use it. |
Right now, the initializr supports grouping the dependencies, for example "Spring Web" and "Spring for GraphQL" are both in the "Web" group on start.spring.io. Do you need more grouping functionality or what exactly is it that you need?
How would this pull request move the selection from the packages from the frontend to the backend?
Those variables are not tied to a dependency? Those are global variables which are just sent from backend to the frontend? What is the use case of those variables? |
Yeah, the grouping is fantastic currently, what i mean by package is that we have example code that depends on multiple dependencies to work out of the box. For working example code
This pull request in its entirety would not move the selection from the packages from the frontend to the backend, but by defining
No, those variables are not tied to a dependency, but we still wish to be able to send our own variables to the frontend to be able to generate projects where these are already integrated by default. The use case of these variables are for instance deciding which pipeline to build with and deciding where the project will be running. |
This is somewhat similar to the "native" dependency on start.spring.io. Users can select it, we can react to it (see this code) and before the project generation we remove it (see this code). But this all happens in the backend. Maybe an approach like this would be suitable for you? In your case, you could define those packages, then write some code with |
That means you have multiple instances of your initializr deployed where those custom fields are set to different values in each instance? |
Thank you for the suggestion! It would definitely cover the functional aspect with regards to the generated project. However, we're also aiming to ensure that users clearly see the included dependencies when they select the package. This approach might lead to similar issues we're currently facing, but I'm open to any ideas that might address both goals. |
No, we use one instance of our initializr, but we would like to be able to send our variables to the frontend, so that the user may choose to include them or not |
Ah, I see. Maybe some feature in the metadata for composite dependencies would help.
Your initializr is a custom Spring Boot application, I guess. Why don't you add your own custom controller and return the custom fields for your frontend in your application? I'll flag this for our next team meeting to discuss it. |
Hey, thanks for the PR and for the discussion. However, we feel that having an untyped map in the configuration is too broad scoped for initializr. I suggest you add your own custom controller for your use case. We can also think about adding an extension point where you can hook into to modify |
The customFields feature in Spring Initializr empowers users to define additional metadata beyond the standard options, offering a high degree of flexibility and adaptability. This feature allows organizations to configure values unique to their specific environments—such as default project configurations, organizational dependencies, version control requirements, deployment targets, and other custom options—thereby enabling projects generated by Initializr to seamlessly align with their internal standards and practices.
With customFields, organizations can dynamically add new metadata properties without the need to alter the core configuration, avoiding the overhead of modifying the base metadata structure whenever new requirements arise. This flexibility extends Spring Initializr’s usability, making it more responsive to evolving business needs and diverse project types. For instance, organizations can use customFields to incorporate information specific to internal workflows, compliance protocols, testing guidelines, or infrastructure requirements, injecting tailored configurations directly into newly generated projects.
By streamlining custom configuration management, customFields enhances Initializr’s adaptability and ensures it can support a broader range of use cases—providing value to organizations that rely on Initializr to maintain consistent, standardized, and easily configurable project setups across development teams.