-
-
Notifications
You must be signed in to change notification settings - Fork 217
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
parametrize the preset json file name in the spring boot configuration #10590
parametrize the preset json file name in the spring boot configuration #10590
Conversation
…le name property injection parameter
…nfiguration at application.yml deleted by previous commits
What exactly has changed since #10578? |
I tagged you in the code comments with explanations. Let me know if it was enough 👍 |
I have not received any notification. Maybe you've started a review session that you have not finished? |
@murdos: Maybe I don't know how to start a review properly when I am the PR owner. I'll play around with two GitHub accounts in another repository to master it, hahaha ;) Changes since the previous PR #10578The bug was fixed by adding this parameter: @Configuration
@EnableConfigurationProperties(JHipsterPresetFileProperties.class)
class JHipsterPresetFilePropertiesConfiguration {
@Bean
JHipsterPresetFile jhipsterPresetFile(JHipsterPresetFileProperties presetFileProperties) {
return new JHipsterPresetFile(PresetName.from(presetFileProperties.getName()));
}
} This was the previous bugged code: @Configuration
@EnableConfigurationProperties(JHipsterPresetFileProperties.class)
class JHipsterPresetFilePropertiesConfiguration {
@Bean
JHipsterPresetFile jhipsterPresetFile() {
return new JHipsterPresetFile(new JHipsterPresetFileProperties().getName());
}
} I used a value object instead of a string and refactored the code to fit that change: package tech.jhipster.lite.project.domain.resource;
import tech.jhipster.lite.project.domain.preset.PresetName;
import tech.jhipster.lite.shared.error.domain.Assert;
public record JHipsterPresetFile(PresetName name) {
public JHipsterPresetFile {
Assert.notNull("name", name);
}
} |
class JHipsterPresetFilePropertiesConfiguration { | ||
|
||
@Bean | ||
JHipsterPresetFile jhipsterPresetFile(JHipsterPresetFileProperties presetFileProperties) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in fact, I would use directly @Value
in repository, to inject the property, no need to use a Configuration and a Bean
@murdos , please WDYT about it? (I tagged here, because I am not sure if you received notification 😅) |
Fix #10553