olá, bom dia, segue abaixo, como solicitado:
@PostMapping("/novo")
public ModelAndView novo(MultipartFile logomarca,Usuario usuario, RedirectAttributes atributes) {
System.out.println(logomarca.getOriginalFilename());
this.usuariosService.salvar(usuario);
atributes.addFlashAttribute("mensagem", String.format("Usuario %s Cadastrado com Sucesso.", usuario.getNome()));
return new ModelAndView("redirect:/usuarios/novo");
}
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
xmlns:th="http://www.thymeleaf.org"
xmlns:data="http://www.thymeleaf.org/extras/data"
layout:decorator="layout/LayoutPadrao">
<head>
<title>Página Principal</title>
</head>
<section layout:fragment="conteudo">
<br />
<h2>Cadastro de Usuario</h2>
<div class="alert alert-success alert-dismissible" role="alert"
th:if="${not #strings.isEmpty(mensagem)}">
<button type="button" class="close" data-dismiss="alert">
<span aria-hidden="true">×</span>
</button>
<span th:text="${mensagem}"></span>
</div>
<form th:action="@{/usuarios/novo}" method="POST"
th:object="${usuario}">
<input type="hidden" th:field="*{idUsuario}" />
<div class="row">
<div class="form-group col-sm-4">
<label>Nome:</label> <input class="form-control"
autofocus="autofocus" th:field="*{nome}" />
</div>
<div class="form-group col-sm-4">
<label>Empresa:</label> <input class="form-control"
autofocus="autofocus" th:field="*{empresa}" />
</div>
<div class="form-group col-sm-4 ">
<label for="cpfOuCnpj" class="control-label">CPF/CNPJ</label> <input
type="text" class="form-control" id="cpfOuCnpj"
th:field="*{cpfOuCnpj}" />
</div>
</div>
<div class="row">
<div class="form-group col-sm-3">
<label>Rua:</label> <input class="form-control "
autofocus="autofocus" th:field="*{endereco.logradouro}" />
</div>
<div class="form-group col-sm-2">
<label>Número:</label> <input class="form-control"
autofocus="autofocus" th:field="*{endereco.numero}" />
</div>
<div class="form-group col-sm-3">
<label>Bairro:</label> <input class="form-control"
autofocus="autofocus" th:field="*{endereco.bairro}" />
</div>
<div class="form-group col-sm-4">
<label>Complemento:</label> <input class="form-control"
autofocus="autofocus" th:field="*{endereco.complemento}" />
</div>
</div>
<div class="row">
<div class="form-group col-sm-3">
<label>Região:</label> <select class="form-control"
th:field="*{endereco.regiao}">
<option value=""></option>
<option th:each=" r : ${regioes}" th:value="${r}"
th:text="${r.descricao}"></option>
</select>
</div>
<div class="form-group col-sm-3">
<label>CEP:</label> <input class="form-control "
autofocus="autofocus" th:field="*{endereco.cep}" />
</div>
<div class="form-group col-sm-3">
<label>UF:</label> <select class="form-control"
th:field="*{endereco.estado}">
<option value="">Selecione</option>
<option th:each="uf : ${ufs}" th:value="${uf}"
th:text="${uf.descricao}"></option>
</select>
</div>
<div class="form-group col-sm-3">
<label>Cidade:</label> <input class="form-control"
autofocus="autofocus" th:field="*{endereco.cidade}" />
</div>
</div>
<div class="row">
<div class="form-group col-sm-4">
<label>Telefone:</label> <input class="form-control "
autofocus="autofocus" th:field="*{telefone}" />
</div>
<div class="form-group col-sm-4">
<label>Senha:</label> <input class="form-control"
autofocus="autofocus" th:field="*{senha}" />
</div>
<div class="form-group col-sm-4">
<label>Confirma Senha:</label> <input class="form-control"
autofocus="autofocus" />
</div>
</div>
<div class="row">
<div class="form-group col-sm-12">
<label>Logomarca da Empresa:</label> <input type="file"
class="form-control" th:field="*{logoMarca}"/>
</div>
</div>
<button class="btn btn-success">Cadastrar</button>
</form>
</section>
<th:block layout:fragment="javascript-extra">
<script th:src="@{/js/nf-mascara-cpf-cnpj.js}"></script>
</th:block>
</html>