title: Using Redirect in Spring Boot
body: <p>Im having trouble using redirect functionality within my spring boot application. As shown in my code below im returning "redirect:/aucConfirm/" but when i initiate this i get a "This application has no explicit mapping" error. </p>
  
  <pre><code>@Controller
  @RequestMapping("/")
  public class WelcomeController {
  
      @Autowired
      AuctionItemRepository aucRepository;
  
  // inject via application.properties
  @Value("${welcome.message:test}")
  private String message = "Hello World";
  
  @RequestMapping(value = "/")
  public String welcome(Map&lt;String, Object&gt; model) {
      model.put("message", this.message);
      return "welcome";
  }
  
  
      @RequestMapping(value = "/sell", method = RequestMethod.GET)
      public String addAuction(Model model, HttpServletRequest request) {
  
  
          model.addAttribute("newAuction", new AuctionItem());
  
          return "NewAuction";
      }
  
      @RequestMapping(value = "/sell", method = RequestMethod.POST)
      public String saveAuction(@ModelAttribute AuctionItem newAuction, RedirectAttributes attributes){
  
  
          return "redirect:/aucConfirm";
      }
  
      @RequestMapping(value = "/aucConfirm", method = RequestMethod.GET)
      public String confirmNewAuction(Model model, HttpServletRequest request) {
  
  
          return "aucConfirm";
      }
  }
  </code></pre>
  
  <p>This is my current configuration class - </p>
  
  <pre><code>@SpringBootApplication
  @ComponentScan
  @EnableJpaRepositories("All")
  @EntityScan("All")
  public class AuctionWebApplication extends SpringBootServletInitializer  {
  
  @Override
  protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
      return application.sources(AuctionWebApplication.class);
  }
  
  public static void main(String[] args) throws Exception {
      SpringApplication.run(AuctionWebApplication.class, args);
  }
  
      @Bean
      DataSource dataSource() {
          DriverManagerDataSource dataSource = new DriverManagerDataSource();
          dataSource.setDriverClassName("com.mysql.jdbc.Driver");
          dataSource.setUrl("jdbc:mysql://localhost:3306/auctiondb?zeroDateTimeBehavior=convertToNull");
          dataSource.setUsername("root");
          dataSource.setPassword("toor");
  
          return dataSource;
      }
  
      @Bean
      public LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource dataSource) {
          LocalContainerEntityManagerFactoryBean entityManager = new LocalContainerEntityManagerFactoryBean();
          entityManager.setDataSource(dataSource);
          entityManager.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
          entityManager.setPackagesToScan("All");
  
          Properties jpaProperties = new Properties();
          jpaProperties.setProperty("hibernate.dialect", "org.hibernate.dialect.MySQLDialect");
          jpaProperties.setProperty("hibernate.hbm2ddl.auto", "update");
          jpaProperties.setProperty("hibernate.id.new_generator_mappings", "false");
          entityManager.setJpaProperties(jpaProperties);
  
          return entityManager;
      }
  </code></pre>
  
  <p>}</p>
  
  <p><em>Update</em></p>
  
  <p>Could it possibly have something to do with my jsp page that im trying to establish the recommit? I have a mvc form here - </p>
  
  <pre><code>&lt;mvc:form class="form-inline" action="${action}" method="post" modelAttribute="newAuction" id="addNewAuc"&gt;
  </code></pre>
  
  <p>and when the user hits the next button it should hit the "redirect:/aucConfirm" -</p>
  
  <pre><code>&lt;button type="submit" name="submit" class="btn btn-success" form="addNewAuc"&gt;Next&lt;/button&gt;
  </code></pre>
  
  <p>Is there anything wrong with this code? Im running out of ideas at this point. Do i need to add anything to my spring boot configuration class to get it working? - Please help!</p>
  
  <p><em>Update 2</em></p>
  
  <p><a href="http://localhost:8080/AuctionWebsite/sell" rel="nofollow noreferrer">http://localhost:8080/AuctionWebsite/sell</a>
  <a href="https://i.stack.imgur.com/fDhqQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fDhqQ.png" alt=""></a></p>
  
  <p>When i enter details int this form and select next i want it to redirect to-
  <a href="http://localhost:8080/AuctionWebsite/aucConfirm" rel="nofollow noreferrer">http://localhost:8080/AuctionWebsite/aucConfirm</a></p>
  
  <p>However this is what appears- </p>
  
  <p><a href="https://i.stack.imgur.com/hpC3S.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hpC3S.png" alt="enter image description here"></a></p>
  
  <p>not redirecting at all and remaining with link <a href="http://localhost:8080/AuctionWebsite/sell" rel="nofollow noreferrer">http://localhost:8080/AuctionWebsite/sell</a></p>
  
  <p><a href="http://localhost:8080/AuctionWebsite/aucConfirm" rel="nofollow noreferrer">http://localhost:8080/AuctionWebsite/aucConfirm</a> works when entered manually</p>
  
  <p>Im getting a little bit desperate at this point, would really appreciate any help. </p>