Skip to content

Instantly share code, notes, and snippets.

@nemrosim
Created April 7, 2021 15:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nemrosim/10b31d2937b949a0dfbf6bffbe0c72b4 to your computer and use it in GitHub Desktop.
Save nemrosim/10b31d2937b949a0dfbf6bffbe0c72b4 to your computer and use it in GitHub Desktop.
package com.nemrosim;
import com.nemrosim.repositories.HibernateUserRepositoryImpl;
import com.nemrosim.repositories.UserRepository;
import com.nemrosim.services.UserService;
import com.nemrosim.services.UserServiceImpl;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class AppConfiguration {
@Bean(name = "userService")
public UserService getUserService() {
UserServiceImpl service = new UserServiceImpl();
service.setRepository(getUserRepository());
return service;
}
@Bean(name = "userRepository")
public UserRepository getUserRepository() {
return new HibernateUserRepositoryImpl();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment