1

I'm new into Spring and Hibernate. I've got a Spring Boot project and I want to integrate Hibernate on my own. Spring Boot tries to configure Hibernate on it's own and I want to switch it off. My project is child of spring-boot-starter-parent

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.2.5.RELEASE</version>
</parent>
4
  • @JakubKubrynski First, I can't choose version of Hibernate. Second, I'd like to configure everything in Java's Annotations, just for practise. Anyway, I'll probably just migrate to standard MVC since Spring Boot does so much for me that I can't handle it. Commented Nov 17, 2015 at 23:55
  • 1
    You can choose versions: stackoverflow.com/questions/29989306/… docs.spring.io/spring-boot/docs/1.2.5.RELEASE/reference/… / <hibernate.version>4.3.11.Final</hibernate.version> . When you fundamentally don't like automagical configuration, don't choose a framework that aims to provide exactly that :) Commented Nov 18, 2015 at 0:11
  • That's absolutely right. Commented Nov 18, 2015 at 0:14
  • @zapl Spring Boot provides more than Hibernate auto configuration :) Commented Nov 18, 2015 at 10:11

1 Answer 1

3

Generally to exclude particular auto configuration in Spring Boot you just need to use annotation:

@Configuration
@EnableAutoConfiguration(exclude={HibernateJpaAutoConfiguration.class})
public class HibernateExclusionConfig {}

But remember that Spring Boot allows you to override single beans by simply defining your instances, for example with @Bean methods in @Configuration classes

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.