Antares

Antares is an SpringBoot extension used to simplify the process of dynamically registering beans to Spring context.

License

License

Categories

Categories

Spring Boot Container Microservices Ant Build Tools
GroupId

GroupId

com.github.prchen
ArtifactId

ArtifactId

spring-boot-starter-antares
Last Version

Last Version

0.0.2
Release Date

Release Date

Type

Type

jar
Description

Description

Antares
Antares is an SpringBoot extension used to simplify the process of dynamically registering beans to Spring context.
Project URL

Project URL

https://github.com/prchen/antares
Source Code Management

Source Code Management

https://github.com/prchen/antares/tree/master

Download spring-boot-starter-antares

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.prchen/spring-boot-starter-antares/ -->
<dependency>
    <groupId>com.github.prchen</groupId>
    <artifactId>spring-boot-starter-antares</artifactId>
    <version>0.0.2</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.prchen/spring-boot-starter-antares/
implementation 'com.github.prchen:spring-boot-starter-antares:0.0.2'
// https://jarcasting.com/artifacts/com.github.prchen/spring-boot-starter-antares/
implementation ("com.github.prchen:spring-boot-starter-antares:0.0.2")
'com.github.prchen:spring-boot-starter-antares:jar:0.0.2'
<dependency org="com.github.prchen" name="spring-boot-starter-antares" rev="0.0.2">
  <artifact name="spring-boot-starter-antares" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.prchen', module='spring-boot-starter-antares', version='0.0.2')
)
libraryDependencies += "com.github.prchen" % "spring-boot-starter-antares" % "0.0.2"
[com.github.prchen/spring-boot-starter-antares "0.0.2"]

Dependencies

provided (1)

Group / Artifact Type Version
org.springframework.boot : spring-boot-starter jar 2.0.0.RELEASE

test (1)

Group / Artifact Type Version
org.springframework.boot : spring-boot-starter-test jar 2.0.0.RELEASE

Project Modules

There are no modules declared in this project.

Antares

Antares is an SpringBoot extension used to simplify the process of dynamically registering beans to Spring context.

Maven Dependency (Java 8)

<dependency>
    <groupId>com.github.prchen</groupId>
    <artifactId>spring-boot-starter-antares</artifactId>
    <version>0.0.2</version>
</dependency>

Sample Project

Anatres Sample

Getting Start

Firstly, define an AntaresManifestAdvice to tell Antares how to collect passengers and which FactoryBean class should be used to create the bean instance.

@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@AntaresManifestAdvice(factoryClass = FooFactoryBean.class)
public @interface Foo {
    // Annotation methods
}

Secondly, implement your own FactoryBean which will create the bean instance.

public class FooFactoryBean extends AntaresFactoryBean {
    @Override
    public Object getObject() throws Exception {
        // Create the bean instance here
        return getObjectType().newInstance();
    }
}

Thirdly, use your own annotation in your code.

@Foo
public class MyBean { }

Put it together.

@AntaresScan
@SpringBootApplication
public class MyApp {
    public static void main(String[] args) {
        SpringApplication.run(MyApp.class, args);
    }
}

@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@AntaresManifestAdvice(factoryClass = FooFactoryBean.class)
public @interface Foo {
    // Annotation methods
}

class FooFactoryBean extends AntaresFactoryBean {
    @Override
    public Object getObject() throws Exception {
        // Create the bean instance here
        return getObjectType().newInstance();
    }
}

@Foo
public class MyBean { }

@Service
class MyService {
    @Autowired
    private MyBean myBean;
}

Versions

Version
0.0.2
0.0.1