title: How do I access datasources in ordinary groovy classes in Grails 3?
body: <p>I'm trying to run sql-code from inside an ordinary Groovy class (no service).
  In Grails 2 I could access a datasource by doing this:  </p>
  
  <pre><code> public GroovyClass() {
      def ctx = ServletContextHolder.servletContext.getAttribute(GrailsApplicationAttributes.APPLICATION_CONTEXT)
      def dataSource = ctx.getBean('dataSource')
      sql = new Sql(dataSource)
   }
  </code></pre>
  
  <p>After migrating to Grails 3.3.8 the code no longer works. What is the correct method in Grails 3.3.8?</p>