diff --git a/build.gradle b/build.gradle index 4a835cd..ad1b313 100644 --- a/build.gradle +++ b/build.gradle @@ -44,6 +44,11 @@ dependencies { implementation "org.mapstruct:mapstruct:1.5.5.Final" annotationProcessor "org.mapstruct:mapstruct-processor:1.5.5.Final" + + implementation 'org.springframework.boot:spring-boot-starter-actuator' + implementation 'io.micrometer:micrometer-registry-prometheus' + + // If you are using mapstruct in test code testAnnotationProcessor "org.mapstruct:mapstruct-processor:1.5.5.Final" diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 22a2ca0..9b7866a 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -25,7 +25,7 @@ spring: defer-datasource-initialization: true database-platform: org.hibernate.dialect.H2Dialect hibernate: - ddl-auto: create-drop + ddl-auto: update # 可选值:create-drop,create,update,none. create-drop:每次启动项目都会删除表,然后重新创建表,适合开发环境;create:每次启动项目都会创建表,适合开发环境;update:每次启动项目都会更新表,适合开发环境;none:不执行任何操作,适合生产环境。 properties: hibernate: @@ -34,6 +34,13 @@ spring: resources: static-locations: classpath:/static/,file:/home/whz/tmp/ # 指定静态资源的位置 +management: + endpoints: + web: + exposure: + include: "*" +# exclude: "health,metrics,prometheus,info,logfile,loggers,env,env-to-props,env-reactive,configprops,configprops-reactive,threaddump,heapdump,beans,scheduledtasks,mappings,httptrace,sessions,caches,cache,sessions-reactive,caches-reactive,cache-reactive,schedules,schedules-reactive,jolokia,jolokia-reactive,logfile-reactive,loggers-reactive,refresh,flyway,liquibase,liquibase-re + app: version: v1 default: @@ -55,6 +62,8 @@ app: methods: [ "GET","PUT","POST"] - path: "/upload/**" methods: [ "GET" ] + - path: "/actuator/**" + methods: [ "GET" ] allowed-origins: # 允许跨域的域名 - "http://localhost:5173" upload: