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
How to Upload a File and Json Data in Postman
Cannot Construct Instance of 'Java.Time.Localdate' - Spring Boot, Elasticseach, Jackson
How to Get the Average of a 2D Array
How to Print Even and Odd Position Characters of an Array of Strings in Java
How to Hide a Request Field in Swagger API
How to Mock a Generic Parameter for a Unit Test in Java
Resource from Src/Main/Resources Not Found After Building With Maven
How to Mock Classes With Constructor Injection
Add Secure Flag to Jsessionid Cookie in Spring Automatically
Multipartexception: Current Request Is Not a Multipart Request
Java 8 Lambda Create List of Strings from List of Objects
How to Skip the First Line of a CSV in Java
How to Update Only the Incoming Fields in a Model Using Spring Data Jpa
How to Send List of Long to Rest Controller Spring Boot
Java: How to Ask User If He/She Wants to Continue Program
How to View Apache Parquet File in Windows
How to Open Excel File Using JavaScript Code Without Using Activex Control