-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
52dbfd9
commit c2e9442
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
src/main/java/com/reine/imagehost/config/ApplicationStartedListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
// 添加您的自定义逻辑在这里 | ||
} | ||
} |