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

Revert "parametrize the preset json file name in the spring boot configuration" #10609

Conversation

murdos
Copy link
Contributor

@murdos murdos commented Aug 19, 2024

Reverts #10590

There're still some issues with customjhlite:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jhipsterPresetFile' defined in class path resource [tech/jhipster/lite/project/infrastructure/secondary/JHipsterPresetFilePropertiesConfiguration.class]: Failed to instantiate [tech.jhipster.lite.project.domain.resource.JHipsterPresetFile]: Factory method 'jhipsterPresetFile' threw exception with message: The field "name" is mandatory and wasn't set (null)
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:648)
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:636)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1355)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1185)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:562)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:522)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:337)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:335)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1443)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1353)
	at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:904)
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:782)
	... 80 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [tech.jhipster.lite.project.domain.resource.JHipsterPresetFile]: Factory method 'jhipsterPresetFile' threw exception with message: The field "name" is mandatory and wasn't set (null)
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:178)
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:644)
	... 94 common frames omitted
Caused by: tech.jhipster.lite.shared.error.domain.MissingMandatoryValueException: The field "name" is mandatory and wasn't set (null)
	at tech.jhipster.lite.shared.error.domain.MissingMandatoryValueException.forNullValue(MissingMandatoryValueException.java:14)
	at tech.jhipster.lite.shared.error.domain.Assert.notNull(Assert.java:41)
	at tech.jhipster.lite.shared.error.domain.Assert$StringAsserter.notNull(Assert.java:334)
	at tech.jhipster.lite.shared.error.domain.Assert$StringAsserter.notBlank(Assert.java:347)
	at tech.jhipster.lite.shared.error.domain.Assert.notBlank(Assert.java:56)
	at tech.jhipster.lite.project.domain.preset.PresetName.<init>(PresetName.java:7)
	at tech.jhipster.lite.project.domain.preset.PresetName.from(PresetName.java:11)
	at tech.jhipster.lite.project.infrastructure.secondary.JHipsterPresetFilePropertiesConfiguration.jhipsterPresetFile(JHipsterPresetFilePropertiesConfiguration.java:15)
	at tech.jhipster.lite.project.infrastructure.secondary.JHipsterPresetFilePropertiesConfiguration$$SpringCGLIB$$0.CGLIB$jhipsterPresetFile$0(<generated>)
	at tech.jhipster.lite.project.infrastructure.secondary.JHipsterPresetFilePropertiesConfiguration$$SpringCGLIB$$FastClass$$1.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:258)
	at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:348)
	at tech.jhipster.lite.project.infrastructure.secondary.JHipsterPresetFilePropertiesConfiguration$$SpringCGLIB$$0.jhipsterPresetFile(<generated>)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:146)
	... 95 common frames omitted

@murdos murdos enabled auto-merge August 19, 2024 08:40
@murdos murdos merged commit 8974397 into main Aug 19, 2024
35 checks passed
@murdos murdos deleted the revert-10590-10553-define-preset-json-file-name-at-spring-boot-application branch August 19, 2024 08:51
@renanfranca
Copy link
Contributor

@murdos : Please, how didi you test it?

Which version of jhipster-lite was in your generated project pom.xml?

@murdos
Copy link
Contributor Author

murdos commented Aug 19, 2024

Which version of jhipster-lite was in your generated project pom.xml?

Build was broken on main branch: https://github.com/jhipster/jhipster-lite/actions/runs/10449333516/job/28932923302

@renanfranca
Copy link
Contributor

Which version of jhipster-lite was in your generated project pom.xml?

Build was broken on main branch: https://github.com/jhipster/jhipster-lite/actions/runs/10449333516/job/28932923302

Thank you very much! I'll try to reproduce it locally by merging my branch with the main, then installing (mvn clean install) the JHipster Lite main branch and generating a custom JHipster Lite from that.

@renanfranca
Copy link
Contributor

@murdos: I tracked it down 😃. Here is a possible fix which I am think to implement:

Edit the custom-jhlite module to add the property in application.yml:

logging:
  level:
    com:
      mycompany:
        myapp: INFO
spring:
  application:
    name: JhipsterSampleApplication
  threads:
    virtual:
      enabled: true
  jackson:
    default-property-inclusion: non_null
jhlite-hidden-resources:
  # Disable the modules and their dependencies by slugs
  slugs: custom-jhlite

# SHOULD ADD IT HERE
jhlite-preset-file:
  name: preset.json

server:
  port: 8080

The issue with this solution is that if a different preset.json name is used in the JHipster Lite project, you'll need to update the custom-jhlite Factory. To solve this problem, I can create the preset.json file in the custom-jhlite Factory and add instructions in the custom-jhlite documentation to modify the preset configurations in preset.json.

WDYT?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants