jhipster / generator-jhipster

JHipster is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures.
https://www.jhipster.tech
Apache License 2.0
21.53k stars 4.02k forks source link

The default profile is ignored when run a application generated with Jhipster 8.4.0 #26333

Closed edilsonmendes closed 4 months ago

edilsonmendes commented 4 months ago
Overview of the issue

I generated an application with jhipster 8.4.0. When I try to run it using the ./mvnw command or npm run backend:debug, it does not display the default profile in the JHipster banner but the @spring.profiles.active@ placeholder. Furthermore, the application fails to create the LoggingConfigurarion bean, as it is unable to inject the value of the server.port property, as shown in the message below.

Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'server.port' in value "${server.port}"

image

image

This property is profile specific (application-dev.yml and application-prod.yml)

The application runs without error if the profile is informed (./mvnw -P dev), however, when changing any file in the backend it fails (same error) when performing the hot reload.

Motivation for or Use Case

The application should run without error using the default profile and shows the correct profile in the banner.

Reproduce the error

-Genarate a monolith JHipster 8.4.0 -Run the application with ./mvnw or npm run backend:debug

Related issues

This error appears to be related to issue #25979.

Suggest a Fix

N/A

JHipster Version(s)

8.4.0

JHipster configuration
  ██║ ██║   ██║ ╚══██╔══╝ ██╔═══██╗ ██╔════╝ ╚══██╔══╝ ██╔═════╝ ██╔═══██╗
    ██║ ████████║    ██║    ███████╔╝ ╚█████╗     ██║    ██████╗   ███████╔╝

██╗ ██║ ██╔═══██║ ██║ ██╔════╝ ╚═══██╗ ██║ ██╔═══╝ ██╔══██║ ╚██████╔╝ ██║ ██║ ████████╗ ██║ ██████╔╝ ██║ ████████╗ ██║ ╚██╗ ╚═════╝ ╚═╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═╝ https://www.jhipster.tech Welcome to JHipster v8.4.0

Welcome to the JHipster Information Sub-Generator

jhipster-oauth-2-sample-application@0.0.1-SNAPSHOT /home/embj/git/tjpe/pure-v8.4.0
└── (empty)
JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
  "generator-jhipster": {
    "applicationType": "monolith",
    "authenticationType": "oauth2",
    "baseName": "jhipsterOauth2SampleApplication",
    "blueprints": [],
    "buildTool": "maven",
    "cacheProvider": "ehcache",
    "clientFramework": "angular",
    "clientPackageManager": "npm",
    "clientTheme": "none",
    "clientThemeVariant": "",
    "clusteredHttpSession": false,
    "creationTimestamp": 1577001617772,
    "databaseType": "sql",
    "devDatabaseType": "h2Memory",
    "devServerPort": 9060,
    "dtoSuffix": "DTO",
    "embeddableLaunchScript": false,
    "enableGradleEnterprise": false,
    "enableHibernateCache": true,
    "enableSocialSignIn": false,
    "enableSwaggerCodegen": false,
    "enableTranslation": false,
    "entities": [
      "SpaceEvent",
      "Mission",
      "Log"
    ],
    "entitySuffix": "",
    "hibernateCache": "ehcache",
    "jhiPrefix": "jhi",
    "jhipsterVersion": "8.4.0",
    "languages": [
      "en"
    ],
    "lastLiquibaseTimestamp": 1716807357000,
    "messageBroker": false,
    "nativeLanguage": "pt-br",
    "otherModules": [],
    "packageFolder": "io/github/jhipster/sample",
    "packageName": "io.github.jhipster.sample",
    "pages": [],
    "prodDatabaseType": "mysql",
    "reactive": false,
    "searchEngine": false,
    "serverPort": 8080,
    "serviceDiscoveryType": false,
    "skipCheckLengthOfIdentifier": false,
    "skipClient": false,
    "skipFakeData": false,
    "skipJhipsterDependencies": true,
    "skipServer": false,
    "skipUserManagement": true,
    "syncUserWithIdp": true,
    "testFrameworks": [
      "gatling",
      "cypress"
    ],
    "useCompass": false,
    "useSass": true,
    "websocket": false,
    "withAdminUi": true
  }
}
Environment and Tools

openjdk version "17.0.6" 2023-01-17 OpenJDK Runtime Environment Temurin-17.0.6+10 (build 17.0.6+10) OpenJDK 64-Bit Server VM Temurin-17.0.6+10 (build 17.0.6+10, mixed mode, sharing)

git version 2.25.1

node: v20.12.2 npm: 10.5.0

Docker version 24.0.1, build 6802122

JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions
@ChangelogDate("20240506143746")
entity SpaceEvent {
  id UUID
  name String required
  date LocalDate required
  description TextBlob required
  photo ImageBlob required
  type SpaceEventType required
}
@ChangelogDate("20240506143747")
entity Mission {
  id UUID
  name String required
  description String
}
@ChangelogDate("20240527105557")
entity Log {
  id UUID
  description String
}
enum SpaceEventType {
  LAUNCH,
  LANDING
}

relationship OneToOne {
  SpaceEvent{mission(name)} to Mission
}
relationship OneToMany {
  Mission{log} to Log{mission}
}

dto SpaceEvent, Mission, Log with mapstruct
paginate SpaceEvent, Mission, Log with pagination
service SpaceEvent, Mission, Log with serviceClass
search SpaceEvent, Mission, Log with no
filter SpaceEvent, Mission, Log

Entity configuration(s) entityName.json files generated in the .jhipster directory
Browsers and Operating System
mraible commented 4 months ago

Can you please try with JHipster 8.5.0?

FWIW, I've been unable to get MySQL to start in Docker with 8.5.0. See https://github.com/jhipster/generator-jhipster/issues/26319 for more information.

edilsonmendes commented 4 months ago

@mraible , sorry for the delay in responding. Yes, the error also occurs in jhipster v8.5.0, as shown in the image below.

Captura de tela 2024-06-07 161449

This error appears to be related to issue #25979.

If I remove the value of the spring.profiles.active property in application.yml the application runs without error.

github-actions[bot] commented 4 months ago

JHipster has completed the sample check .yo-rc.json: valid Entities JDL: valid Application: successfully generated Frontend check: success Backend check: success E2E check: success

This check uses jhipster info output from the issue description to generate the sample. Bug report that does not contain this information will be marked as invalid.

edilsonmendes commented 3 months ago

Hi @mraible, the error remains in version 8.6.0. The application runs without error if the profile is informed (./mvnw -P dev), however, when changing any file in the backend it fails (same error) when performing the hot reload.

Should I open a new issue?

Captura de tela 2024-07-01 170911