Skip to content

Commit 9040621

Browse files
committed
Make LoginAuditService creation unconditional
1 parent bda6a0d commit 9040621

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
package fi.hsl.jore4.auth.audit
22

3+
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
34
import org.springframework.data.jpa.repository.JpaRepository
45
import org.springframework.stereotype.Repository
56

67
/**
78
* Repository for login records.
89
*/
910
@Repository
11+
@ConditionalOnProperty(prefix = "session", name = ["enabled"], havingValue = "true")
1012
interface LoginAuditRepository : JpaRepository<LoginAudit, Long>

src/main/kotlin/fi/hsl/jore4/auth/audit/LoginAuditService.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@ package fi.hsl.jore4.auth.audit
22

33
import org.slf4j.Logger
44
import org.slf4j.LoggerFactory
5-
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean
5+
import org.springframework.beans.factory.annotation.Autowired
6+
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
67
import org.springframework.stereotype.Service
78
import org.springframework.transaction.annotation.Transactional
89

910
/**
1011
* Service for logging login events.
11-
* Only enabled when JPA is available.
1212
*/
1313
@Service
14-
@ConditionalOnBean(LoginAuditRepository::class)
14+
@ConditionalOnProperty(prefix = "session", name = ["enabled"], havingValue = "true")
1515
open class LoginAuditService(
16+
@Autowired(required = true)
1617
private val loginAuditRepository: LoginAuditRepository
1718
) {
1819
companion object {

0 commit comments

Comments
 (0)