• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Java Configuration equivalent to spring XML

 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All,

I'm trying to configure my spring MVC app with java based configuration for the first time. Below is my web.xml



Below is my class to replace web.xml



Below is my spring xml..



And below is my class to replace spring configuration xml...



With xml based configuration, the JdbcTemplate has a reference to JndiObjectFactoryBean datasource as an argument. However, with Java based configuration, it says JdbcTemplate can not accept JndiObjectFatoryBean datasource as an argument. Can you please help me how to fix this? Also with xml configuration I was able to create the datasource bean as abstract="false". How can I implement the same with java config?
 
Bartender
Posts: 1359
39
IBM DB2 Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe I'm wrong, but I'm not sure that org.springframework.jndi.JndiObjectFactoryBean is a DataSource (with DataSource i mean, for example, an instance of DriverManagerDataSource). It seems to me that JndiObjectFactoryBean is an abstraction to lookup into a JNDI registry.
I think you may try to autowire an instance of JndiObjectFactoryBean and then lookup for an instance of DataSource.
reply
    Bookmark Topic Watch Topic
  • New Topic