Commit ff4b8faf authored by 董建华's avatar 董建华

调整加载策略

parent 16f1158d
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
</parent> </parent>
<groupId>cn.quantgroup</groupId> <groupId>cn.quantgroup</groupId>
<artifactId>spring-boot-starter-sentry-ext</artifactId> <artifactId>spring-boot-starter-sentry-ext</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.2-SNAPSHOT</version>
<name>spring-boot-starter-sentry-ext</name> <name>spring-boot-starter-sentry-ext</name>
<description>sentry超时的时候可选钉钉备用</description> <description>sentry超时的时候可选钉钉备用</description>
<packaging>jar</packaging> <packaging>jar</packaging>
......
...@@ -12,6 +12,7 @@ import io.sentry.SentryClientFactory; ...@@ -12,6 +12,7 @@ import io.sentry.SentryClientFactory;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
...@@ -25,6 +26,9 @@ import org.springframework.context.annotation.Configuration; ...@@ -25,6 +26,9 @@ import org.springframework.context.annotation.Configuration;
* @version: * @version:
*/ */
@Slf4j @Slf4j
@ConditionalOnProperty(
name = {"sentry.dsn","threrr"}
)
@Configuration @Configuration
@EnableConfigurationProperties({SentryProperties.class,ThrErrProProperties.class}) @EnableConfigurationProperties({SentryProperties.class,ThrErrProProperties.class})
public class SentryDingdingConfiguration { public class SentryDingdingConfiguration {
...@@ -34,12 +38,14 @@ public class SentryDingdingConfiguration { ...@@ -34,12 +38,14 @@ public class SentryDingdingConfiguration {
@Autowired @Autowired
private ThrErrProProperties thrErrProProperties; private ThrErrProProperties thrErrProProperties;
/**
* 注入不用是保证先初始化SentryClient
*/
@Autowired @Autowired
private SentryClient sentryClient; private SentryClient sentryClient;
@ConfigurationProperties( @ConditionalOnProperty(
prefix = "threrr" name = {"sentry.dsn","threrr"}
) )
@Bean("thrErrSentryClient") @Bean("thrErrSentryClient")
public SentryClient thrErrSentryClient() { public SentryClient thrErrSentryClient() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment