Spring-boot-admin: Allow the navbar logo and/or title to be customized

Created on 8 Jun 2016  路  12Comments  路  Source: codecentric/spring-boot-admin

When there are many environments where the Spring Boot Admin server will be deployed to, it would be helpful to see the environment name as part of the UI. One idea would be to allow a custom logo.
The logo filename could be configurable as an application parameter so that different logos could be set per spring profile.
The logo should be read from the classpath so that it can be packaged with the application.

enhancement server-ui

Most helpful comment

@anandvarkeyphilips try this, its working for me :
add the follorwing to your application.yml (or properties) file.
spring.boot.admin.ui.brand: '<img src=\"assets\/img\/icon-spring-boot-admin.svg\"><span>AML Services Admin Dashboard<\/span>'
make sure assets\/img\/icon-spring-boot-admin.svg\ is under "src/main/resources/META-INF/spring-boot-admin-server-ui

All 12 comments

Have you tried what happens if you place a custom logo at the same place in the classpath? it should take precedence. Sadly it wouldn't be configurable for each environment.

I tried this. I have placed a custom logo (logo.png) at src/resources/img but I always get 404 error. I tried several other locations (src/resources/static/img, src/resources/static/images, src/public/img ...) but I still get 404 error. Can we do something about that. I just want to change the logo and the navigation color (so I want to add a custom css also).

Since SBA registers custom resource handlers, the right place for the custom edited assets would be these:

META-INF/spring-boot-admin-server-ui/img/spring-logo.png
META-INF/spring-boot-admin-server-ui/img/favicon.png
META-INF/spring-boot-admin-server-ui/css/main.css

but exchanging them is more a hack, but works. And with 1.4.x these paths changes slightly (at least for the css).

placing a file called "spring-logo.png" into the resources/META-INF/spring-boot-admin-server-ui/img/ works perfectly and overwrites the original logo with v1.5.2

How did you find that out? This seems not being documented. It works.

But I'd love being able to replace the spring-boot-logo image. But adding a spring-boot-logo.png in the same path did not work.

@sddakoty that file is called platform-spring-boot.png
and the favicon is favicon.png in the same folder

Ok great.

Is it also possible to override the css somehow? I tried adding a META-INF/spring-boot-admin-server-ui/css/main.css as follows, but that did not work (my logo is too large and exceeds the default 160px width):

a.spring-boot-logo span {
    width: 300px !important;
}

@sddakoty if you check the content of the spring-boot-admin-server-ui jar
you can see that the css is called core.css and is in META-INF/spring-boot-admin-server-ui/

Well, I also tried renaming the file to core.css, but still nothing is overridden. The logo width attribute remains the same.

Or if I move it to /META-INF/spring-boot-admin-server-ui/core.css, then the whole css file is replaced which leads to a completely destroyed ui. That's of course not what I want, I just want to override that single attribute...

When there are many environments where the Spring Boot Admin server will be deployed to, it would be helpful to see the environment name as part of the UI.

This seems like a great idea, given that Spring Boot Admin makes it easier to use actuator endpoints that can affect the behavior of applications. It is important to make users aware of which environment they are interacting, and just having different URLs is often overlooked.
Changing the background color is another way to help distinguish between environments.

This is still not working for me.. Is it working??

@anandvarkeyphilips try this, its working for me :
add the follorwing to your application.yml (or properties) file.
spring.boot.admin.ui.brand: '<img src=\"assets\/img\/icon-spring-boot-admin.svg\"><span>AML Services Admin Dashboard<\/span>'
make sure assets\/img\/icon-spring-boot-admin.svg\ is under "src/main/resources/META-INF/spring-boot-admin-server-ui

Was this page helpful?
0 / 5 - 0 ratings