2

I am working on my first spring project, at the moment I can still manage the project but I think when I am going to add more controllers and entities I am going to lose the overview.

In this answer I saw that I should split it up https://stackoverflow.com/a/12399383/2735398

But I am still curious, is there an structure standard? I normally work in Laravel, here is the structure already predefined, and to find, create or delete a model you only need only class. In Spring I need for example an User Entity, Service and a Repository. So I already have 3 times as many files for each table.

The application is just an API. So I don't use any templates(Maybe later for mail).

At the moment I have these folders:
config package: This contains all the class with the @Configuration Annotation, like the websocket config and the interceptor registration.

controllers package: This contains all the controllers.

database package: This contains all the Services and repositories to get entities.

entities package: This contains all the entities.

interceptors package: This contains all the interceptors

services package: This contains all the self made services that can be injected, like a AuthService.

validation package: This contains all request validation, for example is the password long enough.

Community
  • 1
  • 1
Jan Wytze
  • 3,307
  • 5
  • 31
  • 51
  • 1
    There's no standard structure. – Dave Newton May 12 '17 at 17:44
  • There is no standard or convention for where to place your Spring components. What you've defined seems to make sense, you'll probably find yourself adding a few more as you code along (exception, handler, etc). One recommendation I'd make is to drop the 's' off the package names, they're implied plural. – lane.maxwell May 12 '17 at 17:44

0 Answers0