Connect Vaadin flow app to Spring boot admin

Hello everyone :slight_smile:

I’m trying to connect to the spring boot admin app, but I don’t know what i’m doing wrong. usually in a Spring boot app I add the dependencies to the pom.xml, this is the version I’m using

... 
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.0.9</version>
        <relativePath/>
    </parent>

     <properties>
        <java.version>17</java.version>
        <vaadin.version>24.1.4</vaadin.version>
        <selenium.version>4.10.0</selenium.version>
        <spring-cloud.version>2022.0.4</spring-cloud.version>
        <maven.compiler.source>${java.version}</maven.compiler.source>
        <maven.compiler.targer>${java.version}</maven.compiler.targer>
    </properties>

...
    <dependencies>
         <dependency>
              <groupId>de.codecentric</groupId>
              <artifactId>spring-boot-admin-starter-client</artifactId>
              <version>3.3.2</version>
          </dependency>
          <dependency>
              <groupId>org.springframework.boot</groupId>
              <artifactId>spring-boot-starter-actuator</artifactId>
          </dependency>
...

Also in properties.yaml

spring:
  application:
    name: hexagon-primary
  boot:
    admin:
      client:
        url: http://localhost:7070

management:
  endpoint:
    health:
      show-details: always
  endpoints:
    web:
      exposure:
        include: "*"

And finally in SecurityConfiguration.java

@EnableWebSecurity
@Configuration
public class SecurityConfiguration extends VaadinWebSecurity {

    public static final String LOGOUT_URL = "/";

    @Bean
    public PasswordEncoder passwordEncoder() {
        return new BCryptPasswordEncoder();
    }
 
  @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.authorizeHttpRequests(auth ->
                auth.requestMatchers(
                        AntPathRequestMatcher.antMatcher("/actuator/**")).permitAll());
         super.configure(http);

        setLoginView(http, LoginView.class, LOGOUT_URL);
    }
}

If i access to the actuator url expose by vaadin app I see it working, but in my Spring boot admin i can’t see the vaadin app. If i use the same conf in a normal spring boot app, the app can connect to admin.

What I’m missing?

Thanks for your attention

Best regards

There are special classes for the actuators.

Check out jtaf4/src/main/java/ch/jtaf/configuration/security/SecurityConfiguration.java at develop · 72services/jtaf4 · GitHub

1 Like

What is the reason to use an incompatible spring boot admin client with an ancient spring boot version? :wink:

1 Like

The reason is spring-cloud, if i use the new version of spring-boot, the spring cloud feign don’t work, the last version of jdk, vaadin, spring-boot and spring cloud that can run the project without errors is this version. In other projects, this version of spring admin client is running, that why i use it.

Also I update as you said my version of spring-boot-admin-starter-client to 3.3.3, with the configuration from Simon, it works :slight_smile:

Thanks for your reply, I used the configuration at securityConfiguration and it works correctly :slight_smile:, also updated spring-admin-starter-client to 3.3.3.

1 Like