Java 应用程序扩展Neo4JCConfiguration时无法使用InterceptorRegistry
我正在使用带有graphDb(Neo4j)的spring boot应用程序mvc作为我的数据库。Java 应用程序扩展Neo4JCConfiguration时无法使用InterceptorRegistry,java,spring,spring-mvc,internationalization,neo4j,Java,Spring,Spring Mvc,Internationalization,Neo4j,我正在使用带有graphDb(Neo4j)的spring boot应用程序mvc作为我的数据库。 当我必须为我的应用程序进行国际化时,我遇到了问题。 我的应用程序中有此代码。java public class Application extends Neo4jConfiguration { @Autowired GraphDatabase graphDatabase; @Bean GraphDatabaseService graphDatabaseServic
当我必须为我的应用程序进行国际化时,我遇到了问题。
我的应用程序中有此代码。java
public class Application extends Neo4jConfiguration {
@Autowired
GraphDatabase graphDatabase;
@Bean
GraphDatabaseService graphDatabaseService() {
return new GraphDatabaseFactory().newEmbeddedDatabase("my-graphdb");
}
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
当我尝试实施国际化时,导师说我需要实施:
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(localeChangeInterceptor());
}
上述代码需要WebMVCConfigureAdapter扩展该类。这就是问题所在,我没有使用WebMVCConfigureAdapter,因此无法添加上述方法。
我是否有其他选项可以让我的国际化与Neo4jConfiguration一起很好地工作
Neo4jConfiguration
子类,并将其导入到启动应用程序上下文中我刚刚发现如何让它工作。
我只需要添加扩展WebMVCConfigureAdapter的新文件,并将addInterceptors模块放入该新文件中