BasicDataSource переопределяется несовместимым экземпляром компонента типа UrlDecodingDataSource - PullRequest
1 голос
/ 03 апреля 2019

Я пытался открыть свой веб-интерфейс Spring Restful для Pivotal Cloud Foundary, я успешно подключился к базе данных Pivotal MySql, в Local он работает нормально, но когда я запускаю войну в PCF, возникает исключение

    nested exception is java.lang.IllegalStateException: @Bean method
 SpringBeanContainer.dataSource called as bean reference for type
 [org.apache.commons.dbcp2.BasicDataSource] but overridden by non-compatible
 bean instance of type [org.cloudfoundry.reconfiguration.org.springframework.cloud.service.relational.UrlDecodingDataSource].

Я новичок в облаке, и я не очень разбираюсь в этом, кажется, что UrlDecodingDataSource пытается что-то переопределить, из-за этого мой sessionFactory не может создать как бин.

Подробный журнал

      [OUT] org.springframework.beans.factory.UnsatisfiedDependencyException:
     Error creating bean with name 'loginController': Unsatisfied dependency
     expressed through field 'userDetailService'; nested exception is 
    org.springframework.beans.factory.UnsatisfiedDependencyException: 
Error creating bean with name 'userDetailService': Unsatisfied dependency
 expressed through field 'uddDao'; nested exception is
 org.springframework.beans.factory.UnsatisfiedDependencyException: Error
 creating bean with name 'userDetailDaoImpl': Unsatisfied dependency expressed
 through field 'sessionFactory'; nested exception is
 org.springframework.beans.factory.BeanCreationException: Error creating bean
 with name 'sessionFactory' defined in
 com.javarnd.cc.configuration.SpringBeanContainer: Bean instantiation via
 factory method failed; nested exception is
 org.springframework.beans.BeanInstantiationException: Failed to instantiate
 [org.springframework.orm.hibernate5.LocalSessionFactoryBean]: Factory method
 'sessionFactory' threw exception; nested exception is
 java.lang.IllegalStateException: @Bean method SpringBeanContainer.dataSource
 called as bean reference for type [org.apache.commons.dbcp2.BasicDataSource]
 but overridden by non-compatible bean instance of type [org.cloudfoundry.reconfiguration.org.springframework.cloud.service.relational.UrlDecodingDataSource].

Фрагмент источника данных в моем SpringBeanContainer

@Bean // Simple Bean Defination in XML
    public BasicDataSource dataSource() {
        BasicDataSource dataSource = new BasicDataSource();
        dataSource.setDriverClassName(env.getProperty(DRIVER_CLASS));
        dataSource.setUrl(env.getProperty(URL));
        dataSource.setUsername(env.getProperty(USERNAME));
        dataSource.setPassword(env.getProperty(PASSWORD));
        return dataSource;
    }

Пожалуйста, помогите мне решить эту проблему или введите

...