appContext.getBean gives me a proxy and not the manager object I'm looking for

0

Good, I am retouching an old application and I need to make a call to the database to retrieve an information.

It is made in java, spring and hibernate.

I have these variables.

@Autowired private ApplicationContext appContext;

private UsersManagerManager;

and the call I'm doing it like that. UsersManager usersManager = (UsersManager) appContext.getBean ("userManager");

is giving me a proxy, and I do not know what I'm doing wrong, I do not know if I should change something or treat what I recover as the proxy and then extract the data from it.

Greetings and Thanks

    
asked by J. Bravo 06.03.2017 в 18:00
source

1 answer

0

I do not know your XML configuration, but try to inject your ApplicationContext like this:

private static ClassPathXmlApplicationContext appContext = new ClassPathXmlApplicationContext("alguna/ruta/dondeEstaTuArchivoDeConfiguracion/application-context.xml");

Usually it should be in resource.

I hope I help you.

    
answered by 17.03.2017 в 20:17