{"action":"created","issue":{"url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow-server-cloudfoundry/issues/149","repository_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow-server-cloudfoundry","labels_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow-server-cloudfoundry/issues/149/labels{/name}","comments_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow-server-cloudfoundry/issues/149/comments","events_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow-server-cloudfoundry/issues/149/events","html_url":"https://github.com/spring-cloud/spring-cloud-dataflow-server-cloudfoundry/issues/149","id":168981630,"number":149,"title":"datasource hijacking?","user":{"login":"channing-jackson","id":17413412,"avatar_url":"https://avatars.githubusercontent.com/u/17413412?v=3","gravatar_id":"","url":"https://api.github.com/users/channing-jackson","html_url":"https://github.com/channing-jackson","followers_url":"https://api.github.com/users/channing-jackson/followers","following_url":"https://api.github.com/users/channing-jackson/following{/other_user}","gists_url":"https://api.github.com/users/channing-jackson/gists{/gist_id}","starred_url":"https://api.github.com/users/channing-jackson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/channing-jackson/subscriptions","organizations_url":"https://api.github.com/users/channing-jackson/orgs","repos_url":"https://api.github.com/users/channing-jackson/repos","events_url":"https://api.github.com/users/channing-jackson/events{/privacy}","received_events_url":"https://api.github.com/users/channing-jackson/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow-server-cloudfoundry/labels/ready","name":"ready","color":"5319e7"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-08-02T20:33:58Z","updated_at":"2016-08-08T16:43:58Z","closed_at":null,"body":"Using spring-cloud-dataflow-server-cloudfoundry-1.0.0.M4\r\n\r\nBound to services: \r\nredis\r\nmysql\r\nrabbit\r\nspring cloud config server\r\n\r\nI have a custom processor module that makes a connection to an external data source through its own Spring Configuration classes.  It comes from its own Spring Boot application, and I'm trying to leverage it in a stream.  Unit and integration tests are working fine, and I'm trying to test a simple stream http | custom-module | log where posting an id to the http source will result in querying our external datasource for the data, and then log it.\r\n\r\nSpring Configuration (excerpt)\r\n```\r\n@Bean(name = DataConstants.BEAN_CUSTOM_DATASOURCE)\r\nDataSource customDataSource() { }\r\n\r\n@Bean(name = DataConstants.BEAN_VENDOR_ADAPTER) \r\nJpaVendorAdapter customVendorAdapter() { }\r\n\r\n@Bean(name = DataConstants.BEAN_CUSTOM_ENTITY_MGR_FACTORY)\r\nEntityManagerFactory customEntityManagerFactory(JpaVendorAdapter vendorAdapter, DataSource customDataSource) { }\r\n```\r\n\r\nSpring Dao (excerpt)\r\n```\r\n@PersistenceUnit(unitName = \"customPersistenceUnit\")\r\nprotected EntityManagerFactory entityManagerFactory; \r\n\r\npublic EntityManagerFactory getEntityManagerFactory() { } \r\n\r\n@Autowired\r\npublic void setEntityManagerFactory(@Qualifier( DataConstants.BEAN_CUSTOM_ENTITY_MGR_FACTORY) EntityManagerFactory entityManagerFactory) { }\r\n```\r\n\r\nWhat appears to happen when it is deployed is the EntityManagerFactory injected into the Dao is the one from the bound MySQL service instead of the one from my custom Spring configuration.  My queries that should go to the external data source are instead going to the MySQL service, and I'm getting \"table does not exist\" errors.\r\n\r\n---------------------------------\r\nUpdate: if I unbind the MySQL service from the processor app once it is deployed, and restage it, it works fine."},"comment":{"url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow-server-cloudfoundry/issues/comments/238296158","html_url":"https://github.com/spring-cloud/spring-cloud-dataflow-server-cloudfoundry/issues/149#issuecomment-238296158","issue_url":"https://api.github.com/repos/spring-cloud/spring-cloud-dataflow-server-cloudfoundry/issues/149","id":238296158,"user":{"login":"channing-jackson","id":17413412,"avatar_url":"https://avatars.githubusercontent.com/u/17413412?v=3","gravatar_id":"","url":"https://api.github.com/users/channing-jackson","html_url":"https://github.com/channing-jackson","followers_url":"https://api.github.com/users/channing-jackson/followers","following_url":"https://api.github.com/users/channing-jackson/following{/other_user}","gists_url":"https://api.github.com/users/channing-jackson/gists{/gist_id}","starred_url":"https://api.github.com/users/channing-jackson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/channing-jackson/subscriptions","organizations_url":"https://api.github.com/users/channing-jackson/orgs","repos_url":"https://api.github.com/users/channing-jackson/repos","events_url":"https://api.github.com/users/channing-jackson/events{/privacy}","received_events_url":"https://api.github.com/users/channing-jackson/received_events","type":"User","site_admin":false},"created_at":"2016-08-08T16:43:58Z","updated_at":"2016-08-08T16:43:58Z","body":"SCCS is Spring Cloud Config Server. \r\n\r\nI guess I wasn't aware you could customize the bound services on a module-by-module basis.  Would this be done when you define the stream in Spring Cloud Data Flow, or would this be done elsewhere?  Do you have some docs about how to properly bind only the necessary services when defining a stream?\r\n\r\nI can confirm that *after* the deployment, if I unbind the MySQL service and restage just that app, the problem goes away.  Is that what you mean, or do you mean that I should customize the bound services for that app in the stream definition?"}}
{"actor":{"display_login":"channing-jackson"}}