Spring boot, JPA. Repository not a managed type
I Use Spring boot + jpa + h2 and I'm having this exception:
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'userRepository': Invocation of init
method failed; nested exception is java.lang.IllegalArgumentException:
Not a managed type: class com.campsite.users.model.User
Application.java file:
package com.campsite.users.server;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScans;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
/**
* Class that starts the Springboot Application
*/
@EnableAutoConfiguration
@SpringBootApplication
@ComponentScan("com.campsite.users.server", "com.campsite.users.controller","com.campsite.users.manager", "com.campsite.users.model")
@EnableJpaRepositories("com.campsite.users.repository")
public class Application extends SpringBootServletInitializer
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
return application.sources(Application.class);
public static void main(String args) throws Exception
SpringApplication.run(Application.class, args);
ApplicationContext.java file:
package com.campsite.users.server;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class ApplicationContext
// inject via application.properties
@Value("$campsite.module.name")
private String moduleName;
@Bean
public String getModuleName()
return this.moduleName;
UserRepository File:
package com.campsite.users.repository;
import com.campsite.users.model.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface UserRepository extends JpaRepository<User,Long>
User findById(Long id);
UserManager.java File:
package com.campsite.users.manager;
import com.campsite.users.exception.UnexpectedVerbStrategyException;
import com.campsite.users.exception.UserNotExistException;
import com.campsite.users.model.User;
import com.campsite.users.repository.UserRepository;
import com.campsite.users.response.CampsiteResponse;
import com.campsite.users.strategy.AbstractUserStrategy;
import com.campsite.users.strategy.UserActionStrategy;
import com.campsite.users.strategy.VerbStrategy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class UserManager
@Autowired
private UserRepository userRepository;
public CampsiteResponse manage(VerbStrategy verbStrategy, User user)
//bla bla;
I feel really lost with this. I checked another stackoverflow questions but i cant finf what I'm missing.
Thanks
ADDED:
User.java File
package com.campsite.users.model;
import javax.persistence.*;
import java.util.Objects;
@Entity
@Table(name = "user")
public class User
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
@Column(name = "email_address")
private String emailAddress;
@Column(name = "fullName")
private String fullName;
@Column(name = "country")
private String country;
public long getId()
return id;
public void setId(long id)
this.id = id;
public String getEmailAddress()
return emailAddress;
public void setEmailAddress(String emailAddress)
this.emailAddress = emailAddress;
public String getFullName()
return fullName;
public void setFullName(String fullName)
this.fullName = fullName;
public String getCountry()
return country;
public void setCountry(String country)
this.country = country;
@Override
public boolean equals(Object o)
@Override
public int hashCode()
return Objects.hash(emailAddress, fullName);
@Override
public String toString()
return "User" +
"id=" + id +
", emailAddress='" + emailAddress + ''' +
", fullName='" + fullName + ''' +
", country='" + country + ''' +
'';
This is my files structure:
├
── pom.xml
├── src
│ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ └── campsite
│ │ │ └── users
│ │ │ ├── controller
│ │ │ │ └── MainController.java
│ │ │ ├── exception
│ │ │ │ ├── CampsiteException.java
│ │ │ │ ├── UnexpectedVerbStrategyException.java
│ │ │ │ └── UserNotExistException.java
│ │ │ ├── manager
│ │ │ │ └── UserManager.java
│ │ │ ├── model
│ │ │ │ └── User.java
│ │ │ ├── repository
│ │ │ │ └── UserRepository.java
│ │ │ ├── response
│ │ │ │ └── CampsiteResponse.java
│ │ │ ├── server
│ │ │ │ ├── ApplicationContext.java
│ │ │ │ └── Application.java
│ │ │ └── strategy
│ │ │ ├── AbstractUserStrategy.java
│ │ │ ├── UserActionStrategy.java
│ │ │ ├── UserDeleteStrategy.java
│ │ │ ├── UserGetStrategy.java
│ │ │ ├── UserPostStrategy.java
│ │ │ ├── UserPutStrategy.java
│ │ │ └── VerbStrategy.java
│ │ └── resources
│ │ ├── application.properties
java spring-boot repository
|
show 5 more comments
I Use Spring boot + jpa + h2 and I'm having this exception:
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'userRepository': Invocation of init
method failed; nested exception is java.lang.IllegalArgumentException:
Not a managed type: class com.campsite.users.model.User
Application.java file:
package com.campsite.users.server;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScans;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
/**
* Class that starts the Springboot Application
*/
@EnableAutoConfiguration
@SpringBootApplication
@ComponentScan("com.campsite.users.server", "com.campsite.users.controller","com.campsite.users.manager", "com.campsite.users.model")
@EnableJpaRepositories("com.campsite.users.repository")
public class Application extends SpringBootServletInitializer
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
return application.sources(Application.class);
public static void main(String args) throws Exception
SpringApplication.run(Application.class, args);
ApplicationContext.java file:
package com.campsite.users.server;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class ApplicationContext
// inject via application.properties
@Value("$campsite.module.name")
private String moduleName;
@Bean
public String getModuleName()
return this.moduleName;
UserRepository File:
package com.campsite.users.repository;
import com.campsite.users.model.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface UserRepository extends JpaRepository<User,Long>
User findById(Long id);
UserManager.java File:
package com.campsite.users.manager;
import com.campsite.users.exception.UnexpectedVerbStrategyException;
import com.campsite.users.exception.UserNotExistException;
import com.campsite.users.model.User;
import com.campsite.users.repository.UserRepository;
import com.campsite.users.response.CampsiteResponse;
import com.campsite.users.strategy.AbstractUserStrategy;
import com.campsite.users.strategy.UserActionStrategy;
import com.campsite.users.strategy.VerbStrategy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class UserManager
@Autowired
private UserRepository userRepository;
public CampsiteResponse manage(VerbStrategy verbStrategy, User user)
//bla bla;
I feel really lost with this. I checked another stackoverflow questions but i cant finf what I'm missing.
Thanks
ADDED:
User.java File
package com.campsite.users.model;
import javax.persistence.*;
import java.util.Objects;
@Entity
@Table(name = "user")
public class User
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
@Column(name = "email_address")
private String emailAddress;
@Column(name = "fullName")
private String fullName;
@Column(name = "country")
private String country;
public long getId()
return id;
public void setId(long id)
this.id = id;
public String getEmailAddress()
return emailAddress;
public void setEmailAddress(String emailAddress)
this.emailAddress = emailAddress;
public String getFullName()
return fullName;
public void setFullName(String fullName)
this.fullName = fullName;
public String getCountry()
return country;
public void setCountry(String country)
this.country = country;
@Override
public boolean equals(Object o)
@Override
public int hashCode()
return Objects.hash(emailAddress, fullName);
@Override
public String toString()
return "User" +
"id=" + id +
", emailAddress='" + emailAddress + ''' +
", fullName='" + fullName + ''' +
", country='" + country + ''' +
'';
This is my files structure:
├
── pom.xml
├── src
│ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ └── campsite
│ │ │ └── users
│ │ │ ├── controller
│ │ │ │ └── MainController.java
│ │ │ ├── exception
│ │ │ │ ├── CampsiteException.java
│ │ │ │ ├── UnexpectedVerbStrategyException.java
│ │ │ │ └── UserNotExistException.java
│ │ │ ├── manager
│ │ │ │ └── UserManager.java
│ │ │ ├── model
│ │ │ │ └── User.java
│ │ │ ├── repository
│ │ │ │ └── UserRepository.java
│ │ │ ├── response
│ │ │ │ └── CampsiteResponse.java
│ │ │ ├── server
│ │ │ │ ├── ApplicationContext.java
│ │ │ │ └── Application.java
│ │ │ └── strategy
│ │ │ ├── AbstractUserStrategy.java
│ │ │ ├── UserActionStrategy.java
│ │ │ ├── UserDeleteStrategy.java
│ │ │ ├── UserGetStrategy.java
│ │ │ ├── UserPostStrategy.java
│ │ │ ├── UserPutStrategy.java
│ │ │ └── VerbStrategy.java
│ │ └── resources
│ │ ├── application.properties
java spring-boot repository
3
Can you please check @Entity annotation is added on your User Class ?
– Raheela Aslam
Nov 13 '18 at 11:08
@raheela thanks fr your reply. Yes, I added this annotation
– Tincho
Nov 13 '18 at 11:11
1
Did you provide@EnityScan
in your Spring configuration? Also, your entity should implementSerializable
.
– Glains
Nov 13 '18 at 11:19
Please update @ComponentScan as @ComponentScan(basePackages = "com.campsite.users.server", "com.campsite.users.controller","com.campsite.users.manager", "com.campsite.users.model"). and have a look into : springframework.guru/spring-component-scan
– Raheela Aslam
Nov 13 '18 at 11:22
2
I would recommend to move the Application class to com.campsite.users. That way you can remove all annotations on the Application class expect @SpringBootApplication
– Simon Martinelli
Nov 13 '18 at 12:28
|
show 5 more comments
I Use Spring boot + jpa + h2 and I'm having this exception:
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'userRepository': Invocation of init
method failed; nested exception is java.lang.IllegalArgumentException:
Not a managed type: class com.campsite.users.model.User
Application.java file:
package com.campsite.users.server;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScans;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
/**
* Class that starts the Springboot Application
*/
@EnableAutoConfiguration
@SpringBootApplication
@ComponentScan("com.campsite.users.server", "com.campsite.users.controller","com.campsite.users.manager", "com.campsite.users.model")
@EnableJpaRepositories("com.campsite.users.repository")
public class Application extends SpringBootServletInitializer
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
return application.sources(Application.class);
public static void main(String args) throws Exception
SpringApplication.run(Application.class, args);
ApplicationContext.java file:
package com.campsite.users.server;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class ApplicationContext
// inject via application.properties
@Value("$campsite.module.name")
private String moduleName;
@Bean
public String getModuleName()
return this.moduleName;
UserRepository File:
package com.campsite.users.repository;
import com.campsite.users.model.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface UserRepository extends JpaRepository<User,Long>
User findById(Long id);
UserManager.java File:
package com.campsite.users.manager;
import com.campsite.users.exception.UnexpectedVerbStrategyException;
import com.campsite.users.exception.UserNotExistException;
import com.campsite.users.model.User;
import com.campsite.users.repository.UserRepository;
import com.campsite.users.response.CampsiteResponse;
import com.campsite.users.strategy.AbstractUserStrategy;
import com.campsite.users.strategy.UserActionStrategy;
import com.campsite.users.strategy.VerbStrategy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class UserManager
@Autowired
private UserRepository userRepository;
public CampsiteResponse manage(VerbStrategy verbStrategy, User user)
//bla bla;
I feel really lost with this. I checked another stackoverflow questions but i cant finf what I'm missing.
Thanks
ADDED:
User.java File
package com.campsite.users.model;
import javax.persistence.*;
import java.util.Objects;
@Entity
@Table(name = "user")
public class User
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
@Column(name = "email_address")
private String emailAddress;
@Column(name = "fullName")
private String fullName;
@Column(name = "country")
private String country;
public long getId()
return id;
public void setId(long id)
this.id = id;
public String getEmailAddress()
return emailAddress;
public void setEmailAddress(String emailAddress)
this.emailAddress = emailAddress;
public String getFullName()
return fullName;
public void setFullName(String fullName)
this.fullName = fullName;
public String getCountry()
return country;
public void setCountry(String country)
this.country = country;
@Override
public boolean equals(Object o)
@Override
public int hashCode()
return Objects.hash(emailAddress, fullName);
@Override
public String toString()
return "User" +
"id=" + id +
", emailAddress='" + emailAddress + ''' +
", fullName='" + fullName + ''' +
", country='" + country + ''' +
'';
This is my files structure:
├
── pom.xml
├── src
│ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ └── campsite
│ │ │ └── users
│ │ │ ├── controller
│ │ │ │ └── MainController.java
│ │ │ ├── exception
│ │ │ │ ├── CampsiteException.java
│ │ │ │ ├── UnexpectedVerbStrategyException.java
│ │ │ │ └── UserNotExistException.java
│ │ │ ├── manager
│ │ │ │ └── UserManager.java
│ │ │ ├── model
│ │ │ │ └── User.java
│ │ │ ├── repository
│ │ │ │ └── UserRepository.java
│ │ │ ├── response
│ │ │ │ └── CampsiteResponse.java
│ │ │ ├── server
│ │ │ │ ├── ApplicationContext.java
│ │ │ │ └── Application.java
│ │ │ └── strategy
│ │ │ ├── AbstractUserStrategy.java
│ │ │ ├── UserActionStrategy.java
│ │ │ ├── UserDeleteStrategy.java
│ │ │ ├── UserGetStrategy.java
│ │ │ ├── UserPostStrategy.java
│ │ │ ├── UserPutStrategy.java
│ │ │ └── VerbStrategy.java
│ │ └── resources
│ │ ├── application.properties
java spring-boot repository
I Use Spring boot + jpa + h2 and I'm having this exception:
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'userRepository': Invocation of init
method failed; nested exception is java.lang.IllegalArgumentException:
Not a managed type: class com.campsite.users.model.User
Application.java file:
package com.campsite.users.server;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScans;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
/**
* Class that starts the Springboot Application
*/
@EnableAutoConfiguration
@SpringBootApplication
@ComponentScan("com.campsite.users.server", "com.campsite.users.controller","com.campsite.users.manager", "com.campsite.users.model")
@EnableJpaRepositories("com.campsite.users.repository")
public class Application extends SpringBootServletInitializer
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
return application.sources(Application.class);
public static void main(String args) throws Exception
SpringApplication.run(Application.class, args);
ApplicationContext.java file:
package com.campsite.users.server;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class ApplicationContext
// inject via application.properties
@Value("$campsite.module.name")
private String moduleName;
@Bean
public String getModuleName()
return this.moduleName;
UserRepository File:
package com.campsite.users.repository;
import com.campsite.users.model.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface UserRepository extends JpaRepository<User,Long>
User findById(Long id);
UserManager.java File:
package com.campsite.users.manager;
import com.campsite.users.exception.UnexpectedVerbStrategyException;
import com.campsite.users.exception.UserNotExistException;
import com.campsite.users.model.User;
import com.campsite.users.repository.UserRepository;
import com.campsite.users.response.CampsiteResponse;
import com.campsite.users.strategy.AbstractUserStrategy;
import com.campsite.users.strategy.UserActionStrategy;
import com.campsite.users.strategy.VerbStrategy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class UserManager
@Autowired
private UserRepository userRepository;
public CampsiteResponse manage(VerbStrategy verbStrategy, User user)
//bla bla;
I feel really lost with this. I checked another stackoverflow questions but i cant finf what I'm missing.
Thanks
ADDED:
User.java File
package com.campsite.users.model;
import javax.persistence.*;
import java.util.Objects;
@Entity
@Table(name = "user")
public class User
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
@Column(name = "email_address")
private String emailAddress;
@Column(name = "fullName")
private String fullName;
@Column(name = "country")
private String country;
public long getId()
return id;
public void setId(long id)
this.id = id;
public String getEmailAddress()
return emailAddress;
public void setEmailAddress(String emailAddress)
this.emailAddress = emailAddress;
public String getFullName()
return fullName;
public void setFullName(String fullName)
this.fullName = fullName;
public String getCountry()
return country;
public void setCountry(String country)
this.country = country;
@Override
public boolean equals(Object o)
@Override
public int hashCode()
return Objects.hash(emailAddress, fullName);
@Override
public String toString()
return "User" +
"id=" + id +
", emailAddress='" + emailAddress + ''' +
", fullName='" + fullName + ''' +
", country='" + country + ''' +
'';
This is my files structure:
├
── pom.xml
├── src
│ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ └── campsite
│ │ │ └── users
│ │ │ ├── controller
│ │ │ │ └── MainController.java
│ │ │ ├── exception
│ │ │ │ ├── CampsiteException.java
│ │ │ │ ├── UnexpectedVerbStrategyException.java
│ │ │ │ └── UserNotExistException.java
│ │ │ ├── manager
│ │ │ │ └── UserManager.java
│ │ │ ├── model
│ │ │ │ └── User.java
│ │ │ ├── repository
│ │ │ │ └── UserRepository.java
│ │ │ ├── response
│ │ │ │ └── CampsiteResponse.java
│ │ │ ├── server
│ │ │ │ ├── ApplicationContext.java
│ │ │ │ └── Application.java
│ │ │ └── strategy
│ │ │ ├── AbstractUserStrategy.java
│ │ │ ├── UserActionStrategy.java
│ │ │ ├── UserDeleteStrategy.java
│ │ │ ├── UserGetStrategy.java
│ │ │ ├── UserPostStrategy.java
│ │ │ ├── UserPutStrategy.java
│ │ │ └── VerbStrategy.java
│ │ └── resources
│ │ ├── application.properties
java spring-boot repository
java spring-boot repository
edited Nov 13 '18 at 11:34
Tincho
asked Nov 13 '18 at 11:05
TinchoTincho
3711
3711
3
Can you please check @Entity annotation is added on your User Class ?
– Raheela Aslam
Nov 13 '18 at 11:08
@raheela thanks fr your reply. Yes, I added this annotation
– Tincho
Nov 13 '18 at 11:11
1
Did you provide@EnityScan
in your Spring configuration? Also, your entity should implementSerializable
.
– Glains
Nov 13 '18 at 11:19
Please update @ComponentScan as @ComponentScan(basePackages = "com.campsite.users.server", "com.campsite.users.controller","com.campsite.users.manager", "com.campsite.users.model"). and have a look into : springframework.guru/spring-component-scan
– Raheela Aslam
Nov 13 '18 at 11:22
2
I would recommend to move the Application class to com.campsite.users. That way you can remove all annotations on the Application class expect @SpringBootApplication
– Simon Martinelli
Nov 13 '18 at 12:28
|
show 5 more comments
3
Can you please check @Entity annotation is added on your User Class ?
– Raheela Aslam
Nov 13 '18 at 11:08
@raheela thanks fr your reply. Yes, I added this annotation
– Tincho
Nov 13 '18 at 11:11
1
Did you provide@EnityScan
in your Spring configuration? Also, your entity should implementSerializable
.
– Glains
Nov 13 '18 at 11:19
Please update @ComponentScan as @ComponentScan(basePackages = "com.campsite.users.server", "com.campsite.users.controller","com.campsite.users.manager", "com.campsite.users.model"). and have a look into : springframework.guru/spring-component-scan
– Raheela Aslam
Nov 13 '18 at 11:22
2
I would recommend to move the Application class to com.campsite.users. That way you can remove all annotations on the Application class expect @SpringBootApplication
– Simon Martinelli
Nov 13 '18 at 12:28
3
3
Can you please check @Entity annotation is added on your User Class ?
– Raheela Aslam
Nov 13 '18 at 11:08
Can you please check @Entity annotation is added on your User Class ?
– Raheela Aslam
Nov 13 '18 at 11:08
@raheela thanks fr your reply. Yes, I added this annotation
– Tincho
Nov 13 '18 at 11:11
@raheela thanks fr your reply. Yes, I added this annotation
– Tincho
Nov 13 '18 at 11:11
1
1
Did you provide
@EnityScan
in your Spring configuration? Also, your entity should implement Serializable
.– Glains
Nov 13 '18 at 11:19
Did you provide
@EnityScan
in your Spring configuration? Also, your entity should implement Serializable
.– Glains
Nov 13 '18 at 11:19
Please update @ComponentScan as @ComponentScan(basePackages = "com.campsite.users.server", "com.campsite.users.controller","com.campsite.users.manager", "com.campsite.users.model"). and have a look into : springframework.guru/spring-component-scan
– Raheela Aslam
Nov 13 '18 at 11:22
Please update @ComponentScan as @ComponentScan(basePackages = "com.campsite.users.server", "com.campsite.users.controller","com.campsite.users.manager", "com.campsite.users.model"). and have a look into : springframework.guru/spring-component-scan
– Raheela Aslam
Nov 13 '18 at 11:22
2
2
I would recommend to move the Application class to com.campsite.users. That way you can remove all annotations on the Application class expect @SpringBootApplication
– Simon Martinelli
Nov 13 '18 at 12:28
I would recommend to move the Application class to com.campsite.users. That way you can remove all annotations on the Application class expect @SpringBootApplication
– Simon Martinelli
Nov 13 '18 at 12:28
|
show 5 more comments
1 Answer
1
active
oldest
votes
@ComponentScan("com.campsite.users.server", "com.campsite.users.controller","com.campsite.users.manager", "com.campsite.users.model")
@EnableJpaRepositories("com.campsite.users.repository")
I think you don't need to add these annotations when starting a SpringBoot application. Why don't you try without them? Also, move your Application class to com.campsite.users.
Thanks, i'll test your recommendations
– Tincho
Nov 13 '18 at 13:36
You were right! thanks
– Tincho
Nov 13 '18 at 22:43
You're welcome @Tincho
– Ara Kokheba
Nov 14 '18 at 13:59
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53279636%2fspring-boot-jpa-repository-not-a-managed-type%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
@ComponentScan("com.campsite.users.server", "com.campsite.users.controller","com.campsite.users.manager", "com.campsite.users.model")
@EnableJpaRepositories("com.campsite.users.repository")
I think you don't need to add these annotations when starting a SpringBoot application. Why don't you try without them? Also, move your Application class to com.campsite.users.
Thanks, i'll test your recommendations
– Tincho
Nov 13 '18 at 13:36
You were right! thanks
– Tincho
Nov 13 '18 at 22:43
You're welcome @Tincho
– Ara Kokheba
Nov 14 '18 at 13:59
add a comment |
@ComponentScan("com.campsite.users.server", "com.campsite.users.controller","com.campsite.users.manager", "com.campsite.users.model")
@EnableJpaRepositories("com.campsite.users.repository")
I think you don't need to add these annotations when starting a SpringBoot application. Why don't you try without them? Also, move your Application class to com.campsite.users.
Thanks, i'll test your recommendations
– Tincho
Nov 13 '18 at 13:36
You were right! thanks
– Tincho
Nov 13 '18 at 22:43
You're welcome @Tincho
– Ara Kokheba
Nov 14 '18 at 13:59
add a comment |
@ComponentScan("com.campsite.users.server", "com.campsite.users.controller","com.campsite.users.manager", "com.campsite.users.model")
@EnableJpaRepositories("com.campsite.users.repository")
I think you don't need to add these annotations when starting a SpringBoot application. Why don't you try without them? Also, move your Application class to com.campsite.users.
@ComponentScan("com.campsite.users.server", "com.campsite.users.controller","com.campsite.users.manager", "com.campsite.users.model")
@EnableJpaRepositories("com.campsite.users.repository")
I think you don't need to add these annotations when starting a SpringBoot application. Why don't you try without them? Also, move your Application class to com.campsite.users.
answered Nov 13 '18 at 13:17
Ara KokhebaAra Kokheba
463
463
Thanks, i'll test your recommendations
– Tincho
Nov 13 '18 at 13:36
You were right! thanks
– Tincho
Nov 13 '18 at 22:43
You're welcome @Tincho
– Ara Kokheba
Nov 14 '18 at 13:59
add a comment |
Thanks, i'll test your recommendations
– Tincho
Nov 13 '18 at 13:36
You were right! thanks
– Tincho
Nov 13 '18 at 22:43
You're welcome @Tincho
– Ara Kokheba
Nov 14 '18 at 13:59
Thanks, i'll test your recommendations
– Tincho
Nov 13 '18 at 13:36
Thanks, i'll test your recommendations
– Tincho
Nov 13 '18 at 13:36
You were right! thanks
– Tincho
Nov 13 '18 at 22:43
You were right! thanks
– Tincho
Nov 13 '18 at 22:43
You're welcome @Tincho
– Ara Kokheba
Nov 14 '18 at 13:59
You're welcome @Tincho
– Ara Kokheba
Nov 14 '18 at 13:59
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53279636%2fspring-boot-jpa-repository-not-a-managed-type%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
3
Can you please check @Entity annotation is added on your User Class ?
– Raheela Aslam
Nov 13 '18 at 11:08
@raheela thanks fr your reply. Yes, I added this annotation
– Tincho
Nov 13 '18 at 11:11
1
Did you provide
@EnityScan
in your Spring configuration? Also, your entity should implementSerializable
.– Glains
Nov 13 '18 at 11:19
Please update @ComponentScan as @ComponentScan(basePackages = "com.campsite.users.server", "com.campsite.users.controller","com.campsite.users.manager", "com.campsite.users.model"). and have a look into : springframework.guru/spring-component-scan
– Raheela Aslam
Nov 13 '18 at 11:22
2
I would recommend to move the Application class to com.campsite.users. That way you can remove all annotations on the Application class expect @SpringBootApplication
– Simon Martinelli
Nov 13 '18 at 12:28