3
I’m trying to use Springdata on a Jface/SWT project. Because the Crudrepository self implementation feature is something fantastic and very advantageous.
For this, I include here in the classpath the necessary things of Springdata: Spring Data Commons, Spring Data JPA, Spring Bean, Spring Context.
For me, it would only be 4 steps to do this manually:
1 - Include jars in classpath (no classpath error) 2 - Note in the application the information for the Spring exit revoking the classes:
@Configuration
@ComponentScan(basePackages = "org.wender.foobar")
public class ControleGadoApp extends ApplicationWindow {
3 - Create an interface that extends Crudrepository:
public interface Clienterepository extends Crudrepository
4 - Create a class attribute and annotate it with @Autowired
public class TelaCliente extends AbstractTela {
@Autowired
private ClienteRepository repository;
Those four steps weren’t enough, @Autowired didn’t work and the class variable is coming null.
Is there any more configuration?
How are you instantiating the
TelaCliente
? You must have a Spring container that controls the injection of dependencies. Reference: https://docs.spring.io/spring/docs/3.0.x/reference/beans.html– mari
I discovered the problem, I needed to boot my application as Commandline Application (spring boot)
– Wender
Beauty! Put your code here as an answer, to help other people.
– mari