Skip to content

Commit

Permalink
add CoSecModule to AutoConfiguration
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahoo-Wang committed Dec 1, 2022
1 parent e6b74af commit 2562401
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@
*/
package me.ahoo.cosec.spring.boot.starter

import me.ahoo.cosec.policy.serialization.CoSecModule
import org.springframework.boot.autoconfigure.AutoConfiguration
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.context.annotation.Bean

/**
* CoSec AutoConfiguration .
Expand All @@ -23,4 +26,10 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
@AutoConfiguration
@ConditionalOnCoSecEnabled
@EnableConfigurationProperties(CoSecProperties::class)
class CoSecAutoConfiguration
class CoSecAutoConfiguration {
@Bean
@ConditionalOnMissingBean
fun coSecModule(): CoSecModule {
return CoSecModule()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

package me.ahoo.cosec.spring.boot.starter

import me.ahoo.cosec.policy.serialization.CoSecModule
import org.assertj.core.api.AssertionsForInterfaceTypes.assertThat
import org.junit.jupiter.api.Test
import org.springframework.boot.test.context.assertj.AssertableApplicationContext
Expand All @@ -29,6 +30,7 @@ internal class CoSecAutoConfigurationTest {
assertThat(context)
.hasSingleBean(CoSecProperties::class.java)
.hasSingleBean(CoSecAutoConfiguration::class.java)
.hasSingleBean(CoSecModule::class.java)
}
}

Expand Down

0 comments on commit 2562401

Please sign in to comment.