GetInstance () from a @Singleton class in Groovy from Java

Begin

I was unexpectedly caught

@Singleton
class Test{
@I have a=new pen('yeah');
}

Suppose there is such a class

Test test=Test.getInstance();//error

This doesn't bring an instance of the Test class. Why

Conclusion

There is a method that can be accessed like Groovy in Java, so use that.

Test test=(Test)InvokerHelper.getProperty(Test.class,"instance");//OK

Recommended Posts

GetInstance () from a @Singleton class in Groovy from Java
What is a class in Java language (3 /?)
What is a class in Java language (1 /?)
What is a class in Java language (2 /?)
Creating a matrix class in Java Part 1
[Java] About Singleton Class
Java method call from RPG (method call in own class)
How to get Class from Element in Java
A quick review of Java learned in class
A quick review of Java learned in class part4
Extract elements in order from a class type ArrayList
Write a class that can be ordered in Java
Write a class in Kotlin and call it in Java
Quickly implement a singleton with an enum in Java
A quick review of Java learned in class part3
A quick review of Java learned in class part2
Call a program written in Swift from Processing (Java)
Find a subset in Java
Implement Java Interface in JRuby class and call it from Java
How to store a string from ArrayList to String in Java (Personal)
Easily get an integer from a system property in Java
[MQTT / Java] Implemented a class that does MQTT Pub / Sub in Java
Get a non-empty collection from an Optional stream in java
Call Kotlin's sealed class from Java
3 Implement a simple interpreter in Java
I created a PDF in Java.
Run a batch file from Java
Access Teradata from a Java application
StringBuffer and StringBuilder Class in Java
A simple sample callback in Java
Java Calendar is not a singleton.
Get stuck in a Java primer
A little troublesome story in Groovy
I can't create a Java class with a specific name in IntelliJ
[Java] Get data from DB using singleton service in Spring (Boot)
Handle business logic for a set of Entity in Java class
[Note] What I learned in half a year from inexperienced (Java)
[Note] What I learned in half a year from inexperienced (Java) (1)
[Note] What I learned in half a year from inexperienced (Java) (3)
Creating a matrix class in Java Part 2-About matrices (linear algebra)-
About returning a reference in a Java Getter
Study Deep Learning from scratch in Java.
When seeking multiple in a Java array
Call Java method from JavaScript executed in Java
OCR in Java (character recognition from images)
Reverse Key from Value in Java Map
[Creating] A memorandum about coding in Java
Using JavaScript from Java in Rhino 2021 version
Java creates a table in a Word document
Java creates a pie chart in Excel
Try running a Kubernetes Job from Java
Why does Java call a file a class?
Create a TODO app in Java 7 Create Header
Try making a calculator app in Java
Get history from Zabbix server in Java
Implement something like a stack in Java
Split a string with ". (Dot)" in Java
Choose a class hierarchy from tagged classes
I made a class that can use JUMAN and KNP from Java
When calling println etc. from an external Java class file in Processing
[Java] Implement a function that uses a class implemented in the Builder pattern