You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a simple monolithic JHipster project with Angular
Add a JPG to /src/main/webapp/content/images
Modify home.component.scss to use new image
Deploy into production
Image doesn't appear
Additional Observations
1. Create simple monolithic project
I created a simple monolithic project, myapp, with Gradle for the build tool, Angular front end, MariaDB for development and production: See the following .yo-rc.json file:
After project creation, added necessary database username/password to application.yml, liquibase.gradle, etc.
2. Add a JPG to images directory
Added a simple JPG image to the /src/main/webapp/content/images directory. The image I used is attached.
3. Modify home.component.scss to use new image
Modified /src/main/webapp/app/home/home.component.scss to use the JPG image as follows:
.reading {
display: inline-block;
width:347px;
height:497px;
background:url('../../content/images/library.jpg') no-repeat center top;
background-size: contain;
}
/* wait autoprefixer update to allow simple generation of high pixel density media query */@mediaonly screen and (-webkit-min-device-pixel-ratio:2),only screen and (-moz-min-device-pixel-ratio:2),only screen and (-o-min-device-pixel-ratio:2/1),only screen and (min-resolution:192dpi),only screen and (min-resolution:2dppx) {
.reading {
background:url('../../content/images/library.jpg') no-repeat center top;
background-size: contain;
}
}
4. Deploy into production
Deployed the application into production:
Build production JAR: ./gradlew -Pprod clean bootJar
Copy generated JAR to server
Rename JAR to myapp.jar
Launch application: java -jar myapp.jar
Navigate to home page in browser: http://localhost:8080
5. Image doesn't appear
The image does not appear. Browser console error shows:
FWIW, Spring Security changed its behavior between Spring Boot 2 and 3. Spring Boot 2 (aka JHipster 7) was allow by default. Spring Boot 3 is deny by default.
Overview of the issue
JPG images don't show in production.
Motivation for or Use Case
I'd like to use JPG images.
Reproduce the error
Steps to reproduce
/src/main/webapp/content/images
home.component.scss
to use new image1. Create simple monolithic project
I created a simple monolithic project,
myapp
, with Gradle for the build tool, Angular front end, MariaDB for development and production: See the following.yo-rc.json
file:After project creation, added necessary database username/password to
application.yml
,liquibase.gradle
, etc.2. Add a JPG to images directory
Added a simple JPG image to the
/src/main/webapp/content/images
directory. The image I used is attached.3. Modify
home.component.scss
to use new imageModified
/src/main/webapp/app/home/home.component.scss
to use the JPG image as follows:4. Deploy into production
Deployed the application into production:
./gradlew -Pprod clean bootJar
myapp.jar
java -jar myapp.jar
http://localhost:8080
5. Image doesn't appear
The image does not appear. Browser console error shows:
6. Observations
Some observations:
http://localhost:8080/content/images/library.jpg
Related issues
None.
Suggest a Fix
No idea...
JHipster Version(s)
8.1.0
JHipster configuration
See steps above.
Entity configuration(s)
entityName.json
files generated in the.jhipster
directoryNo entities generated (except the core ones).
Browsers and Operating System
The text was updated successfully, but these errors were encountered: