io.github.kilmajster.blog.config.MinimalBlogAutoConfiguration Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of minimal-blog-spring-boot-starter Show documentation
Show all versions of minimal-blog-spring-boot-starter Show documentation
Spring boot starter that provides simplest blog as possible! ⚡️
package io.github.kilmajster.blog.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import io.github.kilmajster.blog.controller.FileBasedBlogController;
import io.github.kilmajster.blog.data.PostsFileBasedRepository;
@Configuration
public class MinimalBlogAutoConfiguration {
@Bean
@ConditionalOnBean(MinimalBlog.class)
public FileBasedBlogController blogController(@Autowired MinimalBlog minimalBlog) {
return new FileBasedBlogController(minimalBlog);
}
@Bean
@ConditionalOnBean(MinimalBlog.class)
public PostsFileBasedRepository postsRepository(@Autowired MinimalBlog minimalBlog) {
return new PostsFileBasedRepository();
}
}