나는이 ObjectifyStartup
는 내가 필요로하는 웹 MVC JavaConfig 파일에 초기화 된 콩은 어떤 DummyEntity
인스턴스로 주입 될 수있다봄 @Configurable는
@Entity
@Cache
@Index
public class DummyEntity {
@Id private Long id;
private ObjectifyStartup objectifyStartup;
private String someData;
//Getters and setters for all
}
이러한 객관화 엔티티 클래스가
@EnableWebMvc
@Configuration
public class SpringWebMvcConfig extends WebMvcConfigurerAdapter {
@Bean
public ObjectifyStartup objectifyStartup() { return new ObjectifyStartupImpl(); }
}
나는 기본적으로 컨트롤러 코드에서이 곳을 수행 할
DummyEntity newDummy = new DummyEntity();
DummyEntity
에서 @Configurable
annotation을 사용하여 스프링 컨테이너에 종속성을 주입해야한다는 것을 알고 있지만이 DI가 작동하도록 DI SpringWebMvcConfig
클래스에 넣어야하는 JavaConfig 코드는 무엇입니까?
여기에 언급 된 모범 사례의 자동 배선으로 인해 GAE의 성능이 저하되어 Autowiring, Component Scan을 사용할 수 없습니다. Spring GAE Optimization. 그리고 내가 만난 모든 솔루션은 과 @ComponentScan
을 <context:spring-configured/>
으로 사용합니다. autowiring보다 주관적인 선언을 사용하는 솔루션을 제공하십시오.