Hi

Yeah it would be nicer if we can make it use the spring boot data
source OOTB, you setup in the application.properties file.

I have logged a ticket
https://issues.apache.org/jira/browse/CAMEL-10618



On Mon, Dec 19, 2016 at 7:19 PM, Launcelot <draja...@standard.com> wrote:
> This could be a rookie mistake, if so apologies in advance
> My router code :
> @SpringBootApplication
> public class MySpringBootRouter extends RouteBuilder {
>
>         @Autowired
>         DataSource dataSource;
>
>         public DataSource getDataSource() {
>                 return dataSource;
>         }
>
>         public void setDataSource(DataSource dataSource) {
>                 this.dataSource = dataSource;
>         }
>
>         @Override
>         public void configure() {
>
>                 DataFormat mySyslog = new SyslogDataFormat().getDataFormat();
>
>                 from("sql:select * from o365investigations.auditaad where
> status=0").routeId("aadroute")
>
> .onException(java.lang.Exception.class).useOriginalMessage().handled(true)
>                                 .to("sql:update o365investigations.auditaad 
> set Status=2 where id =
> :#ID?dataSource=#dataSource")
>                                 .log("Exception in auditaad 
> ").end().transacted()
>                                 .to("sql:update o365investigations.auditaad 
> set status=1 where id =
> :#ID?dataSource=#dataSource")
>
> .to("direct:debug").bean("com.standard.camel.converter.AuditToSyslogBean").marshal(mySyslog)
>                                 .to("mina2:udp://localhost:514?sync=false");
>
>                 from("direct:debug").log("$body");
>
>         }
>
> }
>
> My application.yml :
>
> spring.main.sources: deleteme.MySpringBootRouter
> spring.datasource.url: jdbc:mysql://localhost:3306/o365investigations
>
> spring.datasource.username: <snip>
>
> spring.datasource.password: <snip>
>
> spring.datasource.driver-class-name: com.mysql.jdbc.Driver
>
> On mvn spring-boot:run I get
> Failed to resolve endpoint:
> sql://select%20*%20from%20o365investigations.auditaad%20where%20status=0 due
> to: DataSource must be configured -> [Help 1]
>
> I initially had dataSource=dataSource in the url but changed it to
> #dataSource based on a post i saw trawling for a solution by Mr Ibsen.
> Either way gives me the same error.
>
> Please help,
>
> Thanks
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/sql-component-using-spring-boot-datasource-tp5791719.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Reply via email to