Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into 3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
LostRed committed Apr 16, 2023
2 parents 1f3d401 + 4073390 commit c06351d
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 16 deletions.
4 changes: 2 additions & 2 deletions integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>info.lostred.ruler</groupId>
<artifactId>integration-tests</artifactId>
<version>3.2.7</version>
<version>3.2.8</version>
<name>integration tests</name>
<description>tests for ruler project.</description>

Expand Down Expand Up @@ -39,7 +39,7 @@
<dependency>
<groupId>info.lostred.ruler</groupId>
<artifactId>ruler-spring-boot-starter</artifactId>
<version>3.2.7</version>
<version>3.2.8</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
package info.lostred.ruler.test;

import info.lostred.ruler.annotation.RuleScan;
import info.lostred.ruler.factory.DomainFactory;
import info.lostred.ruler.factory.RuleFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

import java.util.Set;

@SpringBootApplication
@RuleScan("info.lostred.ruler.test.elem")
public class Application {
public static void main(String[] args) {
ConfigurableApplicationContext run = SpringApplication.run(Application.class, args);
DomainFactory bean = run.getBean(DomainFactory.class);
Set<Class<?>> allDomain = bean.getAllDomain();
allDomain.forEach(System.out::println);
RuleFactory bean = run.getBean(RuleFactory.class);
System.out.println(bean);
}
}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<groupId>info.lostred.ruler</groupId>
<artifactId>ruler-project</artifactId>
<packaging>pom</packaging>
<version>3.2.7</version>
<version>3.2.8</version>
<name>ruler project</name>
<description>ruler project</description>

Expand Down
2 changes: 1 addition & 1 deletion ruler-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>info.lostred.ruler</groupId>
<artifactId>ruler-core</artifactId>
<version>3.2.7</version>
<version>3.2.8</version>
<name>ruler core</name>
<description>ruler core.</description>

Expand Down
4 changes: 2 additions & 2 deletions ruler-spring-boot-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>info.lostred.ruler</groupId>
<artifactId>ruler-spring-boot-starter</artifactId>
<version>3.2.7</version>
<version>3.2.8</version>
<name>ruler spring boot starter</name>
<description>ruler's spring boot starter.</description>

Expand Down Expand Up @@ -52,7 +52,7 @@
<dependency>
<groupId>info.lostred.ruler</groupId>
<artifactId>ruler-core</artifactId>
<version>3.2.7</version>
<version>3.2.8</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package info.lostred.ruler.factory;

import info.lostred.ruler.rule.AbstractRule;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.FactoryBean;

/**
Expand All @@ -9,13 +12,12 @@
* @author lostred
* @since 3.2.0
*/
public class RuleFactoryBean implements FactoryBean<AbstractRule> {
public class RuleFactoryBean implements FactoryBean<AbstractRule>, BeanFactoryAware {
private final Class<? extends AbstractRule> ruleClass;
private final RuleFactory ruleFactory;
private RuleFactory ruleFactory;

public RuleFactoryBean(Class<? extends AbstractRule> ruleClass, RuleFactory ruleFactory) {
public RuleFactoryBean(Class<? extends AbstractRule> ruleClass) {
this.ruleClass = ruleClass;
this.ruleFactory = ruleFactory;
}

@Override
Expand All @@ -27,4 +29,9 @@ public AbstractRule getObject() {
public Class<?> getObjectType() {
return ruleClass;
}

@Override
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
this.ruleFactory = beanFactory.getBean(RuleFactory.class);
}
}

0 comments on commit c06351d

Please sign in to comment.