Java.Lang.Illegalargumentexception: Not a Managed Type: Class

Spring boot - Not a managed type

I think replacing @ComponentScan with @ComponentScan("com.nervy.dialer.domain") will work.

Edit :

I have added a sample application to demonstrate how to set up a pooled datasource connection with BoneCP.

The application has the same structure with yours. I hope this will help you to resolve your configuration problems

Spring - Not a managed type: class

Turns out i had to add the entityManagerFactoryRef to the @EnableJpaRepositories annotation in the config class:

@Configuration
@EnableTransactionManagement
@EnableJpaRepositories(
basePackages = { "br.com.brb.maf.pix.transacao.repository" },
entityManagerFactoryRef = "gpiEntityManagerFactory")
@Profile("autoContido")

Getting an error "Not a managed type: class java.lang.Long"

You have RoleRepository class as below

@Repository
public interface RoleRepository extends JpaRepository<Long, Roles>{

@Query("select r from roles r where id = 1")
public List<Roles> getRole(long userId);

}

which needs to be changed as below because the the spring managed entity type Roles need to be the first argument.

@Repository
public interface RoleRepository extends JpaRepository<Roles, Long>{

@Query("select r from roles r where id = 1")
public List<Roles> getRole(long userId);

}

nested exception is java.lang.IllegalArgumentException: Not a managed type: class

Spring is not aware of your entity. You need to denote MySpringBootApplication class with @EntityScan("your.entities.package")

java.lang.IllegalArgumentException: Not a managed type With @Entity and @Repository Setup with Spring Boot 2

So for whatever reason stripping the application down to the following fixed my error.

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;

@SpringBootApplication
@EnableJpaRepositories
public class BrokeragePartyOnboradingApplication {

public static void main(String[] args) {
SpringApplication.run(BrokeragePartyOnboradingApplication.class, args);
}

}

"Not a managed type: class java.lang.Object" when creating a Spring Data repository

In the repository interface if try removing the type from the interface , it will fix your issue:

//                              | No type information needed here! 
interface ConfigParamsRepository extends CrudRepository<ConfigParamsJpa, String> {

}


Related Topics



Leave a reply



Submit