I have been trying to learn spring with the samples.
so i tried to modify the showcase sample to use mysql.
This is what i did in the MainConfig.java. i modified dataSource() function to:
plus i creaded db tables manually from consoleCode:@Inject private Environment environment; @Bean(destroyMethod = "shutdown") public DataSource dataSource() throws Exception { Properties dbcpProperties = new Properties(); dbcpProperties.put("driverClassName", "com.mysql.jdbc.Driver"); dbcpProperties.put("url", "jdbc:mysql://localhost:3306/my_database"); dbcpProperties.put("username", environment.getProperty("dbuser")); dbcpProperties.put("password", environment.getProperty("dbpass")); dbcpProperties.put("initialSize", "3"); dbcpProperties.put("maxActive", "10"); BasicDataSource ds = (BasicDataSource) BasicDataSourceFactory.createDataSource(dbcpProperties); return ds; }
isnt that enough??
i get this error:
Couldn't find a destroy method named 'shutdown' on bean with name 'dataSource'
I am trying to learn spring social please help me.
I want to modify the showcase example to use mysql instead to embedded db.
Thanks in advance.


Reply With Quote