Results 1 to 5 of 5

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

  1. #1
    Join Date
    Feb 2012
    Posts
    11

    Default 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 at 08:35 AM. Reason: Added code tags

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,629

    Default

    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.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Feb 2012
    Posts
    11

    Default

    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

  4. #4
    Join Date
    Feb 2012
    Posts
    11

    Default

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

    thanks

  5. #5
    Join Date
    Aug 2004
    Posts
    1,073

    Default

    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.
    Craig Walls
    Spring Social Project Lead

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •