@enableautoconfiguration(exclude=hibernatejpaaautoconfiguration.class)但是spring仍然启动hibernate,如何解决这个问题?

sauutmhj  于 2021-07-26  发布在  Java
关注(0)|答案(2)|浏览(317)

我有

@EnableAutoConfiguration(exclude = HibernateJpaAutoConfiguration.class)

在我的代码中,但是spring仍然启动hibernate,如何在不完全排除datasourceautoconfiguration的情况下修复这个问题?
Spring Boot2.2.0.释放。

[DEBUG] 2019-11-14 19:01:17.494 [main] TraversableResolvers - Found javax.persistence.Persistence on classpath containing 'getPersistenceUtil'. Assuming JPA 2 environment. Trying to instantiate JPA aware TraversableResolver
        [DEBUG] 2019-11-14 19:01:17.495 [main] TraversableResolvers - Instantiated JPA aware TraversableResolver of type org.hibernate.validator.internal.engine.resolver.JPATraversableResolver.
        [DEBUG] 2019-11-14 19:01:17.495 [main] ResourceBundleMessageInterpolator - Loaded expression factory via original TCCL
        [DEBUG] 2019-11-14 19:01:17.497 [main] TraversableResolvers - Found javax.persistence.Persistence on classpath containing 'getPersistenceUtil'. Assuming JPA 2 environment. Trying to instantiate JPA aware TraversableResolver
        [DEBUG] 2019-11-14 19:01:17.497 [main] TraversableResolvers - Instantiated JPA aware TraversableResolver of type org.hibernate.validator.internal.engine.resolver.JPATraversableResolver.
        [DEBUG] 2019-11-14 19:01:17.498 [main] ConfigurationImpl - Setting custom MessageInterpolator of type org.springframework.validation.beanvalidation.LocaleContextMessageInterpolator
        [DEBUG] 2019-11-14 19:01:17.499 [main] ConfigurationImpl - Setting custom ConstraintValidatorFactory of type org.springframework.validation.beanvalidation.SpringConstraintValidatorFactory
        [DEBUG] 2019-11-14 19:01:17.499 [main] ConfigurationImpl - Setting custom ParameterNameProvider of type org.springframework.validation.beanvalidation.LocalValidatorFactoryBean$1
        [DEBUG] 2019-11-14 19:01:17.501 [main] ValidationXmlParser - Trying to load META-INF/validation.xml for XML based Validator configuration.
        [DEBUG] 2019-11-14 19:01:17.501 [main] ResourceLoaderHelper - Trying to load META-INF/validation.xml via user class loader
[DEBUG] 2019-11-14 19:01:17.501 [main] ResourceLoaderHelper - Trying to load META-INF/validation.xml via TCCL
        [DEBUG] 2019-11-14 19:01:17.502 [main] ResourceLoaderHelper - Trying to load META-INF/validation.xml via Hibernate Validator's class loader
        [DEBUG] 2019-11-14 19:01:17.502 [main] ValidationXmlParser - No META-INF/validation.xml found. Using annotation based configuration only.
        [DEBUG] 2019-11-14 19:01:17.509 [main] ValidatorFactoryImpl - HV000234: Using org.springframework.validation.beanvalidation.LocaleContextMessageInterpolator as ValidatorFactory-scoped message interpolator.
        [DEBUG] 2019-11-14 19:01:17.509 [main] ValidatorFactoryImpl - HV000234: Using org.hibernate.validator.internal.engine.resolver.JPATraversableResolver as ValidatorFactory-scoped traversable resolver.
        [DEBUG] 2019-11-14 19:01:17.510 [main] ValidatorFactoryImpl - HV000234: Using org.hibernate.validator.internal.util.ExecutableParameterNameProvider as ValidatorFactory-scoped parameter name provider.
        [DEBUG] 2019-11-14 19:01:17.510 [main] ValidatorFactoryImpl - HV000234: Using org.hibernate.validator.internal.engine.DefaultClockProvider as ValidatorFactory-scoped clock provider.
        [DEBUG] 2019-11-14 19:01:17.510 [main] ValidatorFactoryImpl - HV000234: Using org.hibernate.validator.internal.engine.scripting.DefaultScriptEvaluatorFactory as ValidatorFactory-scoped script evaluator factory.
        [DEBUG] 2019-11-14 19:01:17.620 [main] TraversableResolvers - Found javax.persistence.Persistence on classpath containing 'getPersistenceUtil'. Assuming JPA 2 environment. Trying to instantiate JPA aware TraversableResolver
        [DEBUG] 2019-11-14 19:01:17.620 [main] TraversableResolvers - Instantiated JPA aware TraversableResolver of type org.hibernate.validator.internal.engine.resolver.JPATraversableResolver.
        [DEBUG] 2019-11-14 19:01:17.620 [main] ResourceBundleMessageInterpolator - Loaded expression factory via original TCCL
        [DEBUG] 2019-11-14 19:01:17.620 [main] ConfigurationImpl - Setting custom MessageInterpolator of type org.springframework.validation.beanvalidation.LocaleContextMessageInterpolator
        [DEBUG] 2019-11-14 19:01:17.621 [main] ConfigurationImpl - Setting custom ConstraintValidatorFactory of type org.springframework.validation.beanvalidation.SpringConstraintValidatorFactory
        [DEBUG] 2019-11-14 19:01:17.621 [main] ConfigurationImpl - Setting custom ParameterNameProvider of type org.springframework.validation.beanvalidation.LocalValidatorFactoryBean$1
        [DEBUG] 2019-11-14 19:01:17.621 [main] ValidationXmlParser - Trying to load META-INF/validation.xml for XML based Validator configuration.
        [DEBUG] 2019-11-14 19:01:17.621 [main] ResourceLoaderHelper - Trying to load META-INF/validation.xml via user class loader
[DEBUG] 2019-11-14 19:01:17.621 [main] ResourceLoaderHelper - Trying to load META-INF/validation.xml via TCCL
        [DEBUG] 2019-11-14 19:01:17.622 [main] ResourceLoaderHelper - Trying to load META-INF/validation.xml via Hibernate Validator's class loader
        [DEBUG] 2019-11-14 19:01:17.622 [main] ValidationXmlParser - No META-INF/validation.xml found. Using annotation based configuration only.
        [DEBUG] 2019-11-14 19:01:17.628 [main] ValidatorFactoryImpl - HV000234: Using org.springframework.validation.beanvalidation.LocaleContextMessageInterpolator as ValidatorFactory-scoped message interpolator.
        [DEBUG] 2019-11-14 19:01:17.628 [main] ValidatorFactoryImpl - HV000234: Using org.hibernate.validator.internal.engine.resolver.JPATraversableResolver as ValidatorFactory-scoped traversable resolver.
        [DEBUG] 2019-11-14 19:01:17.628 [main] ValidatorFactoryImpl - HV000234: Using org.hibernate.validator.internal.util.ExecutableParameterNameProvider as ValidatorFactory-scoped parameter name provider.
        [DEBUG] 2019-11-14 19:01:17.628 [main] ValidatorFactoryImpl - HV000234: Using org.hibernate.validator.internal.engine.DefaultClockProvider as ValidatorFactory-scoped clock provider.
        [DEBUG] 2019-11-14 19:01:17.628 [main] ValidatorFactoryImpl - HV000234: Using org.hibernate.validator.internal.engine.scripting.DefaultScriptEvaluatorFactory as ValidatorFactory-scoped script evaluator factory.
dfddblmv

dfddblmv1#

你需要

@EnableAutoConfiguration(
    exclude = {
      DataSourceAutoConfiguration.class,
      DataSourceTransactionManagerAutoConfiguration.class,
      HibernateJpaAutoConfiguration.class
    })
0x6upsns

0x6upsns2#

日志消息都与hibernate验证器相关,而不是与hibernate(orm)相关。甚至那些提到 javax.persistence 和jpa来自hibernate验证器,因为它做了一些工作来检测它运行在什么样的环境中。

相关问题