Reputation: 31
I need to test different client against each other. for that i need to be able to open different html pages with spring boot.
i tried to do this: Multiple index.html in spring boot but it does only return a string "thick_client" on the webpage.
my controller looks like this:
@RestController
public class ApiController {
@Autowired
private StockRepository stockRepository;
@RequestMapping(value = "/", method = RequestMethod.GET)
public String index() {
return "thick_client";
}
@RequestMapping(value = "/anotherIndex", method = RequestMethod.GET)
public String anotherIndex() {
return "thin_client";
}
application.properties:
spring.mvc.view.prefix=/
spring.mvc.view.suffix=.html
My Folder Structure looks like this:
pom.xml:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.13.0</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
cheers!
Upvotes: 0
Views: 377
Reputation: 90
Try returning the string without the extension. For e.g return "thin_client";
Upvotes: 2