Skip to content

Commit

Permalink
fix 404 on spring 6
Browse files Browse the repository at this point in the history
  • Loading branch information
maxcom committed Sep 28, 2024
1 parent e6ba1b4 commit ca626f0
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/webapp/WEB-INF/springapp-servlet.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@

<!-- the application context definition for the springapp DispatcherServlet -->

<bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping"/>
<bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping"
p:use-trailing-slash-match="true"/>

<context:component-scan base-package="ru.org.linux" use-default-filters="false">
<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
Expand Down
43 changes: 43 additions & 0 deletions src/test/scala/ru/org/linux/topic/ArchiveControllerWebTest.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright 1998-2024 Linux.org.ru
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ru.org.linux.topic

import org.junit.runner.RunWith
import org.specs2.mutable.Specification
import org.specs2.runner.JUnitRunner
import ru.org.linux.test.WebHelper
import sttp.client3.{UriContext, basicRequest}
import sttp.model.StatusCode

@RunWith(classOf[JUnitRunner])
class ArchiveControllerWebTest extends Specification {
"archive controller" should {
"open without slash" in {
val response = basicRequest
.get(uri"${WebHelper.MainUrl}news/archive")
.send(WebHelper.backend)

response.code must be equalTo StatusCode.Ok
}

"open with slash" in {
val response = basicRequest
.get(uri"${WebHelper.MainUrl}news/archive/")
.send(WebHelper.backend)

response.code must be equalTo StatusCode.Ok
}
}
}

0 comments on commit ca626f0

Please sign in to comment.