Skip to content

Commit

Permalink
应用启动时提示信息
Browse files Browse the repository at this point in the history
  • Loading branch information
reine-ishyanami committed Sep 10, 2023
1 parent 52dbfd9 commit c2e9442
Showing 1 changed file with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.reine.imagehost.config;

import jakarta.annotation.Nonnull;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.event.ApplicationStartedEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

/**
* @author reine
*/
@Component
@Slf4j
public class ApplicationStartedListener implements ApplicationListener<ApplicationStartedEvent> {

@Value("${server.port}")
private int port;

@Override
public void onApplicationEvent(@Nonnull ApplicationStartedEvent event) {
// 在应用程序启动后执行的代码
log.info("Knife4j UI: http://localhost:{}/doc.html", port);
// 添加您的自定义逻辑在这里
}
}

0 comments on commit c2e9442

Please sign in to comment.