Spring boot – Not a managed type

I use Spring boot+JPA and having a problem while starting the service. Caused by: java.lang.IllegalArgumentException: Not an managed type: class com.nervytech.dialer.domain.PhoneSettings at org.hibernate.jpa.internal.metamodel.MetamodelImpl.managedType(MetamodelImpl.java:219) at org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation.<init>(JpaMetamodelEntityInformation.java:68) at org.springframework.data.jpa.repository.support.JpaEntityInformationSupport.getMetadata(JpaEntityInformationSupport.java:65) at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getEntityInformation(JpaRepositoryFactory.java:145) at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:89) at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:69) at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:177) at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.initAndReturn(RepositoryFactoryBeanSupport.java:239) at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:225) at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:92) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1625) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1562) Here is the Application.java file, @Configuration @ComponentScan @EnableAutoConfiguration(exclude = { … Read more

Spring Security on Wildfly: error while executing the filter chain

I’m trying to integrate Spring Security SAML Extension with Spring Boot. About the matter, I did develop a complete sample application. Its source code is available on GitHub: spring-boot-saml-integration on GitHub By running it as Spring Boot application (running against the SDK built-in Application Server), the WebApp works fine. Unfortunately, the same AuthN process doesn’t … Read more

What is the difference between ApplicationContext and WebApplicationContext in Spring MVC?

What is the difference between Application Context and Web Application Context? I am aware that WebApplicationContext is used for Spring MVC architecture oriented applications? I want to know what is the use of ApplicationContext in MVC applications? And what kind of beans are defined in ApplicationContext? 5 Answers 5

When use ResponseEntity and @RestController for Spring RESTful applications

I am working with Spring Framework 4.0.7, together with MVC and Rest I can work in peace with: @Controller ResponseEntity<T> For example: @Controller @RequestMapping(“/person”) @Profile(“responseentity”) public class PersonRestResponseEntityController { With the method (just to create) @RequestMapping(value=”https://stackoverflow.com/”, method=RequestMethod.POST) public ResponseEntity<Void> createPerson(@RequestBody Person person, UriComponentsBuilder ucb){ logger.info(“PersonRestResponseEntityController – createPerson”); if(person==null) logger.error(“person is null!!!”); else logger.info(“{}”, person.toString()); personMapRepository.savePerson(person); … Read more

With Spring can I make an optional path variable?

With Spring 3.0, can I have an optional path variable? For example @RequestMapping(value = “/json/{type}”, method = RequestMethod.GET) public @ResponseBody TestBean testAjax( HttpServletRequest req, @PathVariable String type, @RequestParam(“track”) String track) { return new TestBean(); } Here I would like /json/abc or /json to call the same method. One obvious workaround declare type as a request … Read more

How do I mock an autowired @Value field in Spring with Mockito?

I’m using Spring 3.1.4.RELEASE and Mockito 1.9.5. In my Spring class I have: @Value(“#{myProps[‘default.url’]}”) private String defaultUrl; @Value(“#{myProps[‘default.password’]}”) private String defaultrPassword; // … From my JUnit test, which I currently have set up like so: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration({ “classpath:test-context.xml” }) public class MyTest { I would like to mock a value for my “defaultUrl” field. Note … Read more

How do I activate a Spring Boot profile when running from IntelliJ?

I have 5 environments: – local (my development machine) – dev – qc – uat – live – staging I want different application properties to be used for each environment, so I have the following properties files each which have a different URL for the datasource: – application.properties (containing common properties) – application-local.properties – application-dev.properties … Read more