Skip to content
Advertisement

Tag: spring

How Spring @Autowired binds the SessionFactory object even if there is no SessionFactory instance available

I’m using Hibernate and Spring with Java-based configurations. My config file is this one: Working fine. No problem with this, but when I manually try to set the sessionfactory parameter for trasactionManager, like this: The IDE is showing: So, I created a sessionFactory like below and passed to trasactionManager It worked. My question is how spring autowired the sessionFactory object

No Dialect mapping for JDBC type: 1111

I’m working on a Spring JPA Application, using MySQL as database. I ensured that all spring-jpa libraries, hibernate and mysql-connector-java is loaded. I’m running a mysql 5 instance. Here is a excerpt of my application.properties file: When executing an integration test, spring startsup properly but fails on creating the hibernate SessionFactory, with the exception: I think my dialects should be

Spring Boot – Error creating bean with name ‘dataSource’ defined in class path resource

I have Spring Boot web application. It’s centered around RESTful approach. All configuration seems in place but for some reason MainController fails to handle request. It results in 404 error. How to fix it? Application ParserController UPDATE Seems like MySQL cannot be initialized by Spring…. UPDATE2 application.properties UPDATE4 Seems lite controllers not responding eventhough @RequestMapping are set. Why might it

Spring MVC request and response flow explanation

I can’t find correct client request flow in below syntax.Could someone please clarify what is happening here? If possible please specify what are the corresponding spring classes/interfaces used in spring MVC process. Answer Request will be received by DispatcherServlet. DispatcherServlet will take the help of HandlerMapping and get to know the @Controller class name associated with the given request. So

Maven: No sources to compile

I am following the ‘Build Java Projects with Maven’ (https://spring.io/guides/gs/maven/#scratch) and when I run ‘mvn compile’ from /Users/Misha/Desktop/src/main/java/hello, I get this prompt: I have the two java files and the xml file in the hello directory, and I am assuming that I should see “Hello World!” instead of No sources to compile. Why is my java code not compiling? Thanks!

HTTP Status 500 – Handler processing failed; nested exception is java.lang.NoClassDefFoundError:

I’m trying to integrate external jar file into my project. (mambu-models-V3.8.10.jar) But I receive such error message: root cause: Here is my POM xml: http://maven.apache.org/maven-v4_0_0.xsd”> 4.0.0 com.springapp kapiv2 war 1.0-SNAPSHOT kapi There are a lot of results in google if you search NoClassDefFoundError – but none of them hellped me. could you please tell me why I receive such error?

Detached entity passed to persist when save the child data

I’m getting this error when submitting the form: org.hibernate.PersistentObjectException: detached entity passed to persist: com.project.pmet.model.Account; nested exception is javax.persistence.PersistenceException: org.hibernate.PersistentObjectException: detached entity passed to persist: com.project.pmet.model.Account Here are my entities: Account: Team: Here’s a part of the Controller: And the form: What am I doing wrong? Answer Save method accepts only transient objects. What is the transient object you can

Spring junit tests with couchbase

I have some Services that should get documents from couchbase. Services: Also I have DocRepository interface with necessary methods and views on couchbase server. When I run my app and call Services its work fine, but I need tests for this Services. Tests: Running tests successful only in 90%. And another moment, I use maven, and when it runs tests

Running code after Spring Boot starts

I want to run code after my spring-boot app starts to monitor a directory for changes. I have tried running a new thread but the @Autowired services have not been set at that point. I have been able to find ApplicationPreparedEvent, which fires before the @Autowired annotations are set. Ideally I would like the event to fire once the application

Apache Camel mock endpoint

I recently started to investigate Apache Camel and I have one issue. I start writing some test for my routes, and there are a lot of examples, where “to” part of route is written as So, I wrote a test, where I am exepcting to have mock:result as last endproint. Here is the questions: Is this important to write mock:result

Advertisement