Announcement Announcement Module
Collapse
No announcement yet.
Couldn't find a destroy method na med 'shutdown' on bean with name 'dataSource' Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Couldn't find a destroy method na med 'shutdown' on bean with name 'dataSource'

    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:

    Code:
    @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;
    }
    plus i creaded db tables manually from console

    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.
    Last edited by habuma; Mar 6th, 2012, 08:35 AM. Reason: Added code tags

  • #2
    Please use code tags when posting code. What is it you don't understand about the error/stacktrace... The BasicDataSource doesn't have a method called shutdown this is also what the exception tells you, it has a close method which you can use.

    Comment


    • #3
      thank you, for the reply,
      that solved the problem

      i have another question. in the online documentation for spring social
      http://static.springsource.org/sprin...onnecting.html

      in the disconnecting section it says:

      To delete a connection via ConnectController, submit a DELETE request to "/connect/{provider}".
      In order to support this through a form in a web browser, you'll need to have Spring's HiddenHttpMethodFilter configured in your application's web.xml. Then you can provide a disconnect button via a form like this:
      Code:
      <form action="<c:url value="/connect/twitter" />" method="post">
         <div class="formInfo">
            <p>Spring Social Showcase is connected to your Twitter account.
               Click the button if you wish to disconnect.</p>
         </div>
         <button type="submit">Disconnect</button>	
         <input type="hidden" name="_method" value="delete" />
      </form>
      When this form is submitted, ConnectController will disconnect the user's account from the provider. It does this by calling the disconnect() method on each of the ServiceProviderConnections returned by the provider's getConnections() method.


      My question is it possible to disconnect from only one/some of the ServiceProviderConnections

      Comment


      • #4
        kind of figured out:
        DELETE /connect/{providerId}/{providerUserId}

        thanks

        Comment


        • #5
          Yes, in order to delete a single connection you must include the provider user ID associated with the connection as part of the URL. Looks like you figured it out.

          Comment

          Working...
          X