使用Spring Boot进行机器学习

时间:2018-01-02 11:26:21

标签: spring spring-mvc spring-boot machine-learning

我有一个春季启动应用程序,其中包含一些机器学习权重文件?我想知道spring boot是否在Container Startup上初始化了类?或者当某个请求进来时它会这样做吗?每次HTTP请求进来时我都不想解析这些文件?他们是一种阅读这些文件并在每次请求时使用它们的方式吗?

1 个答案:

答案 0 :(得分:1)

您可以像这样编写自定义类

@Component
public class ApplicationStartup 
implements ApplicationListener<ApplicationReadyEvent> {

  /**
   * This event is executed as late as conceivably possible to indicate that 
   * the application is ready to service requests.
   */
  @Override
  public void onApplicationEvent(final ApplicationReadyEvent event) {

    // here your code ...

    return;
  }
}