by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 31 2019 16:18
    sivaprasadreddy edited #806
  • Jan 31 2019 16:18
    sivaprasadreddy edited #806
  • Jan 31 2019 16:17
    sivaprasadreddy opened #806
  • Jan 31 2019 15:32
  • Jan 31 2019 15:14

    snicoll on new-generator

    Adapt to latest API change Move InitializrDefaultStarterBu… (compare)

  • Jan 31 2019 10:42

    snicoll on new-generator

    Switch project structure to use… (compare)

  • Jan 31 2019 10:34

    snicoll on master

    Upgrade to JUnit 5.4.0-RC1 Split metadata specific excepti… (compare)

  • Jan 31 2019 09:43

    snicoll on master

    Initiate 0.8.0.BUILD-SNAPSHOT v… (compare)

  • Jan 31 2019 08:13
    phoenigm starred spring-io/initializr
  • Jan 31 2019 03:43
  • Jan 31 2019 03:04

    mbhave on new-generator

    Adapt tests to use new API Customize build version based o… (compare)

  • Jan 30 2019 19:28
    mbhave closed #805
  • Jan 30 2019 19:27

    mbhave on master

    Fix generate release notes scri… (compare)

  • Jan 30 2019 19:26
    mbhave edited #805
  • Jan 30 2019 19:26
    mbhave commented #805
  • Jan 30 2019 19:05
    snicoll milestoned #805
  • Jan 30 2019 19:05
    snicoll labeled #805
  • Jan 30 2019 19:05
    snicoll assigned #805
  • Jan 30 2019 19:05
    snicoll opened #805
  • Jan 30 2019 19:04
    snicoll milestoned #804
Eric Deandrea
@edeandrea
We even add our own custom in-house dependencies to the UI by following the guide
we have our own internal BOMs & version ranges
and based on whether the user picks them we customize how we generate the project
Another interesting thing the Initializr does is it publishes events with details about every project that is generated. We capture that event and store it out in DynamoDB (using spring-data-dynamodb) so that we can track over time what kinds of projects are being generated
Eric Deandrea
@edeandrea
to do that you can just create your own bean which does
@EventListener
@Async
public void handleEvent(io.spring.initializr.generator.ProjectRequestEvent event) {
  // Do whatever you want with this event
}
triberraar
@triberraar
yeah i was pretty sure that it wasn't public
Eric Deandrea
@edeandrea
Short of changing the UI i haven’t found anything it can’t do yet
everything you customize works regardless if you are using it from the browser, directly from curl, or using STS/IntelliJ
Emma Katherine
@emmakatehatesyo_twitter
The documentation says that once we run the application, we'll see the interface... Is that at a particular localhost endpoint? Is that when running by command line? How do we get there....
triberraar
@triberraar
so i made some headway (in a mostly ugly way). I was wondering if there is a way to change the standard groupID from com.example to whatever my companies one is
triberraar
@triberraar
Another question. i have been running the app for a bit now and generated quite a few projects. i see that there are many directories in my tmp folder. do they get cleaned automatically?
Eric Deandrea
@edeandrea
Hi @triberraar yes you can change the defaults to lots of the values. The tuning default values section in the guide is a good resource
in src/main/resource/application.yml you can just do
Initializr:
initializr:
  artifactId:
    value: your-default-artifact-id
  groupId:
    value: your-default-group-id
  name:
    value: Your default project name
  description:
    value: Your default project description
  packageName:
    value: your.default.package.name
  version:
    value: your.default.version
@emmakatehatesyo_twitter Its just like any other spring boot application - once you run it you need to go to a browser (i.e. http://localhost:8080) to view the web UI
triberraar
@triberraar
hmm i though i tried that one, guess i did it wrong, works now though. Thanks
Stéphane Nicoll
@snicoll
@emmakatehatesyo_twitter the app should be available at localhost:8080
@edeandrea looks like you’ve added quite a lot of customizations there, that’s amazing. Is that work open source?
@triberraar folders should get cleaned automatically once the request completes. Are you sure those are related to initializr?
Eric Deandrea
@edeandrea
Hi @snicoll yes we have tailored and customized it quite a bit. Unfortunately it is proprietary :(
I can talk generically about what we’ve done
and how we’ve done it
but i can’t share whole the entire project code as it uses some of our own internal libraries
And tools
Eric Deandrea
@edeandrea
some of the things we’ve done:
  • Force into our own build tools (Java is the only choice, Gradle project is the only choice)
  • Wiring generated projects to use our own custom Gradle distro sourced from our own internal artifact repository
  • Adding some of our own internal libraries to the dependencies page and then auto-selecting other depenencies if they are chosen
  • Customizing the generation of the resulting project based on dependencies that are picked
    • i.e. if one of our custom framework dependencies is picked, then generate the project in a certain way with things like a Swagger configuration class already there, custom gradle plugins applied in the build file, etc
  • Making REST calls to our internal artifact repositories to figure out latest versions of internal libraries upon project generation
  • Listening for the io.spring.initializr.generator.ProjectRequestEvent and asynchronously publishing that info (along with other http header information that comes from our internal infrastructure) into a DynamoDB table using spring-data-dynamodb
  • Providing an endpoint which uses Apache POI to read the data from the DynamoDB table and essentially export it to Excel for viewing
    • We’re not doing anything with the data yet but the hope is to capture it over time and then help us better make decisions in the future about offerings we want to provide
  • Hook the initializr app into our Spring Boot Admin & Zipkin dashboards
  • Build/run the initializr app on Java 10
Stéphane Nicoll
@snicoll
That’s awesome, thanks a lot for the feedback
Eric Deandrea
@edeandrea
One thing that would be a nice enhancement is for the ProjectRequestPostProcessor to have access to the model that was created in the ProjectGenerator. We have lots of logic that could be considered “post processing” logic but the logic was based off something we calculated within ProjectGenerator.resolveModel. I didn’t want to have to re-compute those values in each post processor, so a lot of the logic is actually inside our ProjectGenerator class
Stéphane Nicoll
@snicoll
I understand why you’d want that but exposing the model would be going too far in such high-level hook points
Eric Deandrea
@edeandrea
i was tempted to use a request-scoped bean and model the data I wanted to share with the post processors in that…but decided against that approach
so instead my resolveModel method has a bunch of conditionals that put some boolean flags into the model that can then be read by other methods in the ProjectGenerator as well as in the templates themselves
we also manipulate the list of BOMs…for example if the user selects anything that would pull in the spring-cloud BOM and also picks one of our custom dependency (which sits on top of spring boot and controls versions of certain BOMs, including spring-cloud), we then cycle through and remove the spring-cloud BOM from the list of selected boms so that it doesn’t show up in the build file
Stéphane Nicoll
@snicoll
Initializr is not really meant to be customized that much as a library. This is possible the way you’ve done it but that requires you to access way too much of the internals. We have plans to make that much easier but unfortunately we haven’t had the time/resource to excute on that
Your use cases will be very precious once we start brainstorming about the new API so thanks for sharing :)
Eric Deandrea
@edeandrea
Feel free to reach out anytime if you want to pick my brain about what we’ve done
Stéphane Nicoll
@snicoll
Thanks!
Eric Deandrea
@edeandrea
i basically started from looking at the source within the initializr-service module to figure out how to do a lot of what we are doing. I even copied in all the post processors from there as-is
figured i would need/want them
my last company I built our own custom Eclipse plugins that essentially did Spring MVC (not Spring Boot) project generation - this is 10,000 times simpler than maintaining that!
Stéphane Nicoll
@snicoll
Glad to hear that :)
Paul Balogh
@javaducky
hi @snicoll I was wondering about the status of spring-io/initializr#730 . Just wanted to make sure you weren’t waiting for anything from me.
Stéphane Nicoll
@snicoll
@javaducky All good, I just need some time to review and merge. The last few weeks have been a bit crazy :)
Thanks for the ping
Paul Balogh
@javaducky
no problem…and thank you! i just wasn’t sure of the process, so wanted to make sure i’m not a “bad” dev :)
Stéphane Nicoll
@snicoll
Not at all :)
Paul Balogh
@javaducky
we also have a customized version of initializr and i continually rebase our changes onto a fork of your upstream.
not as fancy sounding as @edeandrea ’s setup, but we have ours also create new repositories in BitBucket and create build/deploy plans in Bamboo
Stéphane Nicoll
@snicoll
Sweet
Emma Katherine
@emmakatehatesyo_twitter
When I go to localhost:8080 there is no ui, when I go to localhost:8080/UI/dependencies I do get the list of dependencies, however... Is there something I'm missing?
Stéphane Nicoll
@snicoll
@emmakatehatesyo_twitter you should definitely get a UI on :8080/ - Did you follow the build from source section? https://github.com/spring-io/initializr#building-from-source
Eric Deandrea
@edeandrea

Is it possible to define a dependency in a custom Initializr that shows up on the UI to pick, but when picked it brings in 2 dependencies? I’ve added many of my organization’s own dependencies by following the guide at https://docs.spring.io/initializr/docs/current/reference/htmlsingle/#create-instance-dependencies but there is a case where I want to add a 3rd party dependency to the UI that, when selected, should bring in 2 dependencies. I couldn't figure out how to do that declaratively within application.yml.

The only solution I came up with was to declare one of the dependencies in application.yml and then add a ProjectRequestPostProcessor where the postProcessAfterResolution method looks for the dependency added to application.yml and then adds the second one if the 1st one is found. Although it works it doesn’t seem quite ideal.