Skip to content

Failed to load a service: io.micronaut.context.exceptions.BeanContextException: | Micronaut

I have just created a file named I am not calling this class anywhere as of now

package com.example.Transactions;


// @Repository
public interface TransactionsRepository {

Whenever I run ./gradlew run, it runs perfectly, but the moment I uncomment this line, it throws an error



Exception in thread “main” java.lang.RuntimeException: Failed to load a service: io.micronaut.context.exceptions.BeanContextException: Unexpected error loading be an definition [com.example.$Transactions.TransactionsRepository$Intercepted$Definition]: failed to access class com.example.Transactions.TransactionsRepository$In tercepted from class com.example.$Transactions.TransactionsRepository$Intercepted$Definition$Reference (com.example.Transactions.TransactionsRepository$Intercepte d and com.example.$Transactions.TransactionsRepository$Intercepted$Definition$Reference are in unnamed module of loader ‘app’)

I even tried doing this but still does not work

public interface TransactionsRepository extends  CrudRepository<Transaction, Long>{

I have also included below line in my gradle file


I am very new to micronaut. Its been hours I am trying this. I dont know whats wrong in this code. Please help me if I am missing something.



It’s probably the package name – package sub-names should not start with uppercase letters. Change com.example.Transactions to com.example.transactions (and rename the directory from Transactions to transactions.