Skip to content

Commit

Permalink
feat:v1.2.1-beta1
Browse files Browse the repository at this point in the history
  • Loading branch information
AnswerAIL committed Sep 15, 2021
1 parent b4db2fb commit ff49c0d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>com.github.answerail</groupId>
<artifactId>dinger-spring-boot-starter</artifactId>
<packaging>jar</packaging>
<version>1.2.1-beta</version>
<version>1.2.1-beta1</version>

<name>dinger-spring-boot-starter</name>
<description>Dinger-SpringBoot集成钉钉/企业微信群机器人实现消息通知中间件</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.core.io.support.ResourcePatternResolver;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;

import java.io.IOException;

/**
* DingerAutoConfiguration
*
Expand All @@ -42,16 +45,15 @@
public class DingerAutoConfiguration implements InitializingBean {
private final DingerProperties properties;
private final DingerRobot dingerRobot;
private final ResourceLoader resourceLoader;
private final ResourcePatternResolver resourceLoader;

public DingerAutoConfiguration(
DingerProperties dingerProperties,
DingerRobot dingerRobot,
ResourceLoader resourceLoader
DingerRobot dingerRobot
) {
this.properties = dingerProperties;
this.dingerRobot = dingerRobot;
this.resourceLoader = resourceLoader;
this.resourceLoader = new PathMatchingResourcePatternResolver();
}

@Bean
Expand All @@ -71,15 +73,15 @@ public void afterPropertiesSet() throws Exception {
checkConfigFileExists();
}

private void checkConfigFileExists() {
private void checkConfigFileExists() throws IOException {

if (
StringUtils.hasText(this.properties.getDingerLocations())
) {

Resource resource = this.resourceLoader.getResource(this.properties.getDingerLocations());
Resource[] resources = this.resourceLoader.getResources(this.properties.getDingerLocations());

Assert.state(resource.exists(), "Cannot find config location: " + resource
Assert.state(resources.length > 0, "Cannot find config location: " + this.properties.getDingerLocations()
+ " (please add config file or check your Dinger configuration)");
}
}
Expand Down

0 comments on commit ff49c0d

Please sign in to comment.