The SRX is a firewall that has routing and switching capabilities and, like in a L3 switch, you could configure vlans and assing a L3 interface to each vlan to act as the "gateway" for users within that vlan. This way the users within a specific vlan could communicate with other subnets.
The SRX is not a router, it is a firewall but as mentioned it has great routing and switching capabilities. You can configure, like in a regular router, static routing, dynamic routing (OSPF, BGP, MPLS. etc), DHCP, etc. There is even an option for turning all security options off and use it like a router (packet-based mode):
Regarding your second quesiton, it really depends on what you want to implement. If you want the SRX to be the default gateway and you are using vlans and IRBs then yes, your hosts should point the IRB's address when they want to reach other subnets.
Likewise you could have the hosts connected to a switch and that switch connected to a regular SRX's interface like ge-0/0/1.0 and have the hosts point to the ge-0/0/1.0's address as their default gateway. However following this approach you could end up wasting physical ports on the SRX while you could be using IRBs (virtual interfaces) instead.
Another option is to configure different vlans on the switch where the hosts are connected to and then create a trunk link between the switch and the SRX and use vlan-tagging on the physical interface of the SRX. (This is router-on-a-stick in Cisco world).
So basically, so as to not waste ports on the SRX, I could make certain ports on the SRX ethernet-switching family with VLAN access type as trunk, then each VLAN assigned an IRB L3 interface (corresponding to the VLAN's subnet), then each IRB assigned to a pertinent security zone. Our DHCP server would then assign the default gateway as the IRB addresses.
You might need to connect multiple devices that belong to the same IP subnet (maybe switches) to the SRX and you don't want to change the IP addresses.
Now, depending on the Junos version, the type of SRX, and the mode your SRX is configured for (transparent, mixed, or switching mode):
- the irb interface can only be used to connect to the SRX from devices in the vlan, with no routing between irbs (vlans) or between irbs and interfaces that might be configured as L3 interfaces (transparent mode or mixed mode respectively), OR
- the irb interface can be used to connect to the SRX, and also for intervlan routing or routing between irbs and interfaces that might be configured as L3 interfaces (switching mode).
The mode can be checked with: show ethernet-switching global-information, and can be changed with set protocols l2-learning global-mode (switching | transparent-bridge) with proper Junos version. The default also varies based on the SRX type and Junos version.