java - Creating a Spring bean from a Groovy class leads to "cannot find symbol error" -


i have groovy class returns instance of data base client:

class dbclient {  private static dbclient instance  private string url private string username private string password private string driver  @synchronized static dbclient getinstance() {     if (!instance) {         instance = new dbclient()     }     return instance }   sql sql = sql.newinstance(url, username, password, driver)  void seturl(string url) {     this.url = url }  void setusername(string username) {     this.username = username }  void setpassword(string password) {     this.password = password }  void setdriver(string driver) {     this.driver = driver }   def getallsaa() {     sql.rows("select * saa") } } 

i try create bean of class in @configuration class:

@configuration @profile("prod") public class oracleserverconfiguration {  @bean public dbclient dbclient () {      dbclient dbclient = dbclient.getinstance();      dbclient.seturl("jdbc:oracle:thin:@localhost:1521:xe");     dbclient.setusername("system");     dbclient.setpassword("1111");     dbclient.setdriver("oracle.jdbc.oracledriver");      return dbclient; } } 

it looks ok in intellij, when try build project gradle, error

"oracleserverconfiguration.java:14: error: cannot find symbol dbclient dbclient = dbclient.getinstance(); symbol: class dbclient location: class oracleserverconfiguration".

i tried creating getters , setters fields in dbclient class, no avail.

does have experience creating beans groovy classes?

a similar question answered here: referencing groovy java gradle , spring boot results in"cannot find symbol" in case, decided keep module in groovy, fixed problem.


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -