Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/reporting-services/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么';我的基于Spring的web应用程序不会响应其定义的端点_Spring_Websphere Liberty - Fatal编程技术网

为什么';我的基于Spring的web应用程序不会响应其定义的端点

为什么';我的基于Spring的web应用程序不会响应其定义的端点,spring,websphere-liberty,Spring,Websphere Liberty,我正在开发一个简单的基于Spring的web服务userSetting,以便在Liberty 8.5.5.9上运行。我能够构建和部署服务,当我启动它时,它似乎理解它的上下文根(userSetting),但没有理解它的端点;我相信我遗漏了应用程序各部分中一些基本的基于Spring的链接,但我不知道是哪一个 应用程序的主类如下所示: @SpringBootApplication @ImportResource("classpath:spring-resource1.xml") @Import({RE

我正在开发一个简单的基于Spring的web服务
userSetting
,以便在Liberty 8.5.5.9上运行。我能够构建和部署服务,当我启动它时,它似乎理解它的上下文根(
userSetting
),但没有理解它的端点;我相信我遗漏了应用程序各部分中一些基本的基于Spring的链接,但我不知道是哪一个

应用程序的主类如下所示:

@SpringBootApplication
@ImportResource("classpath:spring-resource1.xml")
@Import({RESTInterface.class})
public class UserSettingApplication {

  private static final LoggerUtils logger = new LoggerUtils( UserSettingApplication.class );

  public static void main(String[] args) {
          logger.debug( "Entering UserSettingApplication.main()" );
          System.out.println( "Entering UserSettingApplication.main()" );
    SpringApplication.run(UserSettingApplication.class, args);
          logger.debug( "Exiting UserSettingApplication.main()" );
          System.out.println( "Exiting UserSettingApplication.main()" );
 }

  // Dan Vega says:  Remember that this going to execute after the 
  // application context is loaded so you could use it to check if 
  // certain beans exist or what values of certain properties are. 

  @Bean
  public CommandLineRunner commandLineRunner(ApplicationContext ctx) {
    return args -> {

      logger.info("Let's inspect the beans provided by Spring Boot:");

      String[] beanNames = ctx.getBeanDefinitionNames();
      Arrays.sort(beanNames);
      for (String beanName : beanNames) {
        logger.info(beanName);
      }
    };
  }
}
定义端点(缩写为单个端点)的类是:

当我尝试点击端点时
http://localhost:9080/userSetting/userSetting/hello
,我得到一个信息:

Error 404: java.io.FileNotFoundException: SRVE0190E: File not found: /userSetting/hello
RestController
似乎未正确连接到应用程序;在绝望中,我尝试在主类中添加以下行:

@Import({RESTInterface.class})
但这并没有改变任何事情。有人能告诉我如何正确连接端点吗?

试试
如果在Liberty内部运行,则在url中两次给出“userSetting”

,更改类定义以扩展SpringBootServletializer,如下所示
UserSettingApplication扩展SpringBootServletializer
并覆盖
配置
方法
@Import({RESTInterface.class})